diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2013-08-10 17:18:12 +0200 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2013-08-10 17:18:12 +0200 |
commit | 6714d6fc820e56ea53cd67e604a0928e7a974e84 (patch) | |
tree | dba649c6bc5bc2c0135c1823112809db602bfc80 /src/gui/gui-buffer.c | |
parent | a5cbfdf7fd38a14be47c898a66aac5737bbb1c4b (diff) | |
download | weechat-6714d6fc820e56ea53cd67e604a0928e7a974e84.zip |
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.
Diffstat (limited to 'src/gui/gui-buffer.c')
-rw-r--r-- | src/gui/gui-buffer.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/gui/gui-buffer.c b/src/gui/gui-buffer.c index 2f8352eb4..5b33a8c58 100644 --- a/src/gui/gui-buffer.c +++ b/src/gui/gui-buffer.c @@ -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); |