summaryrefslogtreecommitdiffstats
path: root/GUI
diff options
context:
space:
mode:
authoryum <yum.food.vr@gmail.com>2023-04-25 14:27:23 -0700
committeryum <yum.food.vr@gmail.com>2023-04-25 14:27:23 -0700
commit8534d17ab00de729867bb482ab204854127ed2a1 (patch)
tree8286b7fdad01049f48bded1556fd7e13fe67385d /GUI
parent783c44b2e667dc70c517234906de8a0016d3e914 (diff)
Restore string matching, remove affinity maskv0.11.1
Affinity mask no longer affects performance. String matching is still needed for temporal stability in fast-paced long-form transcription tasks.
Diffstat (limited to 'GUI')
-rw-r--r--GUI/GUI/GUI/Config.cpp2
-rw-r--r--GUI/GUI/GUI/PythonWrapper.cpp61
2 files changed, 1 insertions, 62 deletions
diff --git a/GUI/GUI/GUI/Config.cpp b/GUI/GUI/GUI/Config.cpp
index f35f95c..f45aa45 100644
--- a/GUI/GUI/GUI/Config.cpp
+++ b/GUI/GUI/GUI/Config.cpp
@@ -66,7 +66,7 @@ AppConfig::AppConfig(wxTextCtrl* out)
language("english"),
model("base.en"),
button("left joystick"),
- window_duration("120"),
+ window_duration("15"),
enable_local_beep(true),
use_cpu(false),
diff --git a/GUI/GUI/GUI/PythonWrapper.cpp b/GUI/GUI/GUI/PythonWrapper.cpp
index 3a7cc5d..e6b9a70 100644
--- a/GUI/GUI/GUI/PythonWrapper.cpp
+++ b/GUI/GUI/GUI/PythonWrapper.cpp
@@ -98,64 +98,6 @@ std::string DrainWin32Pipe(const HANDLE pipe) {
return oss.str();
}
-bool SetAffinityMask(
- HANDLE hProcess,
- const std::function<void(const std::string& out, const std::string& err)> out_cb)
-{
- // Set process affinity mask. This is an simple optimization pointed out by
- // a user. Constraining any of the processes used by the STT to a reduced
- // number of processors does not affect user-visible performance.
- {
- // Query processor information.
- SYSTEM_INFO sysinfo{};
- GetSystemInfo(&sysinfo);
- //sysinfo.dwNumberOfProcessors
-
- // Pick a random processor.
- unsigned int rand_num;
- auto err = rand_s(&rand_num);
- if (err) {
- std::ostringstream err_oss;
- err_oss << "Failed to get random number: " << err << std::endl;
- out_cb("", err_oss.str());
- return false;
- }
- // Constrain the processor ID to [1, num_processors).
- // We don't want to run on processor 0 since it receives system interrupts
- int processor_id = rand_num;
- switch (sysinfo.dwNumberOfProcessors) {
- // case 0 can never happen.
- case 1:
- processor_id = 0;
- case 2:
- processor_id = rand_num % 2;
- default:
- processor_id = (processor_id % (sysinfo.dwNumberOfProcessors - 1)) + 1;
- }
- DWORD_PTR affinity_mask = 0;
- processor_id = std::min(processor_id,
- static_cast<int>(sizeof(affinity_mask)));
- affinity_mask = 1LL << processor_id;
-
- if (!SetProcessAffinityMask(hProcess, affinity_mask)) {
- std::ostringstream err_oss;
- err_oss << "Failed to set affinity mask: " << GetWin32ErrMsg();
- out_cb("", err_oss.str());
- return false;
- }
-
-#if 0
- {
- std::ostringstream oss;
- oss << "Set affinity mask to " << affinity_mask <<
- ", i.e. processor " << processor_id << std::endl;
- out_cb(oss.str(), "");
- }
-#endif
- }
- return true;
-}
-
bool PythonWrapper::InvokeCommandWithArgs(const std::string& cmd,
std::vector<std::string>&& args,
const std::function<void(const std::string& out, const std::string& err)>&& out_cb,
@@ -339,9 +281,6 @@ bool PythonWrapper::InvokeCommandWithArgs(const std::string& cmd,
CloseHandle(pi.hThread);
});
- // Set affinity mask (best effort)
- SetAffinityMask(pi.hProcess, out_cb);
-
// While the process is running, drain output and send input every 10 ms.
DWORD timeout_ms = 10;
DWORD ret = WAIT_TIMEOUT;