[geary/mainline: 1/2] conversation: update GUI every 10 mails



commit ca39992139de15785a8f0ecccd1a5fa7421cb2f7
Author: Konstantin Kharlamov <Hi-Angel yandex ru>
Date:   Wed Mar 27 02:12:02 2019 +0300

    conversation: update GUI every 10 mails
    
    Each call to throttle_loading() takes ≈150..250 ms, which slows down
    loading mails a lot. For now let's work around it by calling the
    function less times in the cycle.
    
    time foreach took, before 51110.635 ms
    time foreach took, after   6577.519 ms
    
    Signed-off-by: Konstantin Kharlamov <Hi-Angel yandex ru>

 src/client/conversation-viewer/conversation-list-box.vala | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/src/client/conversation-viewer/conversation-list-box.vala 
b/src/client/conversation-viewer/conversation-list-box.vala
index 781ada34..571a6c2a 100644
--- a/src/client/conversation-viewer/conversation-list-box.vala
+++ b/src/client/conversation-viewer/conversation-list-box.vala
@@ -826,6 +826,7 @@ public class ConversationListBox : Gtk.ListBox, Geary.BaseInterface {
         // but keep the scrollbar adjusted so that the first
         // interesting message remains visible.
         Gtk.Adjustment listbox_adj = get_adjustment();
+        int i_mail_loaded = 0;
         foreach (Geary.Email email in to_insert) {
             EmailRow row = add_email(email, false);
             // Since uninteresting rows are inserted above the
@@ -841,7 +842,9 @@ public class ConversationListBox : Gtk.ListBox, Geary.BaseInterface {
             loading_height = 0;
 
             yield row.view.load_avatar(this.avatar_store);
-            yield throttle_loading();
+            if (i_mail_loaded % 10 == 0)
+                yield throttle_loading();
+            ++i_mail_loaded;
         }
 
         set_sort_func(on_sort);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]