mirror of
https://github.com/weechat/weechat.git
synced 2026-06-30 14:56:39 +02:00
core: optimize the removal of lines in buffers (a lot faster to clear/close buffers with lot of lines)
The update of variables "buffer_max_length" and "prefix_max_length" in struct t_gui_lines is now delayed and made during the main refresh (in main loop). For a buffer with 50K lines, it is up to 3300 times faster to clear/close it. For a buffer with 4096 lines (default limit), it is up to 120 times faster.
This commit is contained in:
@@ -1013,7 +1013,7 @@ gui_buffer_set_short_name (struct t_gui_buffer *buffer, const char *short_name)
|
||||
strdup (short_name) : NULL;
|
||||
|
||||
if (buffer->mixed_lines)
|
||||
gui_line_compute_buffer_max_length (buffer, buffer->mixed_lines);
|
||||
buffer->mixed_lines->buffer_max_length_refresh = 1;
|
||||
gui_buffer_ask_chat_refresh (buffer, 1);
|
||||
|
||||
hook_signal_send ("buffer_renamed",
|
||||
@@ -2741,9 +2741,8 @@ gui_buffer_unmerge (struct t_gui_buffer *buffer, int number)
|
||||
|
||||
if (ptr_new_active_buffer)
|
||||
{
|
||||
gui_line_compute_prefix_max_length (ptr_new_active_buffer->mixed_lines);
|
||||
gui_line_compute_buffer_max_length (ptr_new_active_buffer,
|
||||
ptr_new_active_buffer->mixed_lines);
|
||||
ptr_new_active_buffer->mixed_lines->prefix_max_length_refresh = 1;
|
||||
ptr_new_active_buffer->mixed_lines->buffer_max_length_refresh = 1;
|
||||
}
|
||||
|
||||
gui_window_ask_refresh (1);
|
||||
|
||||
Reference in New Issue
Block a user