Merge pull request #38 from momo5502/bugfix/console
Speed up console logging by concatenating indiviual messages
This commit is contained in:
commit
c8f9d2dc90
@ -230,14 +230,21 @@ namespace console
|
|||||||
{
|
{
|
||||||
while (!terminate_runner)
|
while (!terminate_runner)
|
||||||
{
|
{
|
||||||
|
std::string message_buffer{};
|
||||||
auto current_queue = empty_message_queue();
|
auto current_queue = empty_message_queue();
|
||||||
|
|
||||||
while (!current_queue.empty())
|
while (!current_queue.empty())
|
||||||
{
|
{
|
||||||
const auto& msg = current_queue.front();
|
const auto& msg = current_queue.front();
|
||||||
print_message_to_console(msg.data());
|
message_buffer.append(msg);
|
||||||
current_queue.pop();
|
current_queue.pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!message_buffer.empty())
|
||||||
|
{
|
||||||
|
print_message_to_console(message_buffer.data());
|
||||||
|
}
|
||||||
|
|
||||||
std::this_thread::sleep_for(5ms);
|
std::this_thread::sleep_for(5ms);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user