[latexila] Completion: use g_list_prepend() instead of append()



commit ca6c9773768d6034a4968c107485cac86362921b
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Thu Oct 16 16:43:29 2014 +0200

    Completion: use g_list_prepend() instead of append()
    
    append() has O(N) time complexity, so doing it in a loop is not really a
    good idea… prepend() is O(1). And anyway the list is sorted at the end.

 src/completion.vala |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/src/completion.vala b/src/completion.vala
index 9e5878a..cece274 100644
--- a/src/completion.vala
+++ b/src/completion.vala
@@ -911,7 +911,7 @@ public class CompletionProvider : GLib.Object, SourceCompletionProvider
                     pixbuf,
                     get_command_info (_current_command));
 
-                _proposals.append (item);
+                _proposals.prepend (item);
 
                 // We don't need to store commands that have no arguments,
                 // they are only in _proposals, it's sufficient.


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