Skip to content

Commit

Permalink
Fix a performance issue when the server sends many messages
Browse files Browse the repository at this point in the history
This is for instance the case at the beginning of a turn. The code was resizing
every row for each recieved message, resulting in O(N^2) complexity. Change it
to resize only the new row for O(N) complexity.

Closes #615.
  • Loading branch information
lmoureaux committed Sep 2, 2021
1 parent 5cfbf93 commit 185b0ed
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion client/gui-qt/messagewin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ void messagewdg::msg(const struct message *pmsg)
item->setIcon(QIcon(*pix));
}
mesg_table->setItem(i, 0, item);
msg_update();
mesg_table->resizeRowToContents(i);
mesg_table->scrollToBottom();
}

Expand Down

0 comments on commit 185b0ed

Please sign in to comment.