perf optimization

This commit is contained in:
Akash Mozumdar 2019-02-06 19:48:42 -05:00
parent ac86323010
commit 5e53e63e07

View File

@ -41,14 +41,17 @@ void TextThread::Push(const BYTE* data, int len)
else Host::AddConsoleOutput(INVALID_CODEPAGE);
lastPushTime = GetTickCount();
if (std::all_of(buffer.begin(), buffer.end(), [&](wchar_t c) { return repeatingChars.count(c) > 0; })) buffer.clear();
if (filterRepetition && Util::RemoveRepetition(buffer)) // sentence repetition detected, which means the entire sentence has already been received
if (filterRepetition)
{
if (std::all_of(buffer.begin(), buffer.end(), [&](auto ch) { return repeatingChars.find(ch) != repeatingChars.end(); })) buffer.clear();
if (Util::RemoveRepetition(buffer)) // sentence repetition detected, which means the entire sentence has already been received
{
repeatingChars = std::unordered_set(buffer.begin(), buffer.end());
AddSentence(buffer);
buffer.clear();
}
}
}
void TextThread::Flush()
{