From 59869dc45a00112454dba1ca92b46b590a6abd4f Mon Sep 17 00:00:00 2001 From: Akash Mozumdar Date: Thu, 15 Nov 2018 00:29:21 -0500 Subject: [PATCH] optimize repetition removal at cost of some correctness (can be dealt with by extensions) --- GUI/host/textthread.cc | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/GUI/host/textthread.cc b/GUI/host/textthread.cc index c095892..86c0465 100644 --- a/GUI/host/textthread.cc +++ b/GUI/host/textthread.cc @@ -50,14 +50,10 @@ void TextThread::Flush() { std::wstring sentence = buffer; buffer.clear(); + repeatingChars.clear(); - locker.unlock(); // This algorithm might take a while - std::unordered_set repeatingChars; - for (std::wsmatch results; std::regex_search(sentence, results, std::wregex(L"([^\\x00]{6,})\\1\\1")); sentence = results[1]) + for (std::wsmatch results; std::regex_search(sentence, results, std::wregex(L"^([^]{6,})\\1\\1")); sentence = results[1]) repeatingChars = std::unordered_set(sentence.begin(), sentence.end()); - locker.lock(); - - this->repeatingChars = repeatingChars; locker.unlock(); AddSentence(sentence);