changeset 1945:89e1e4b392b4 trunk

[svn] - optimize for single-character searches (dramatic JTF speedboost)
author nenolod
date Sun, 05 Nov 2006 13:55:21 -0800
parents e3cd747562d6
children 12bf555c8e47
files ChangeLog audacious/mainwin.c
diffstat 2 files changed, 13 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sun Nov 05 13:49:20 2006 -0800
+++ b/ChangeLog	Sun Nov 05 13:55:21 2006 -0800
@@ -1,3 +1,11 @@
+2006-11-05 21:49:20 +0000  William Pitcock <nenolod@nenolod.net>
+  revision [2845]
+  - improve algorithm further
+  
+  trunk/audacious/mainwin.c |   10 ++++------
+  1 file changed, 4 insertions(+), 6 deletions(-)
+
+
 2006-11-05 21:33:25 +0000  William Pitcock <nenolod@nenolod.net>
   revision [2843]
   - use g_strcasecmp instead of several g_strdowns to speed up jump-to-file performance. closes #56
--- a/audacious/mainwin.c	Sun Nov 05 13:49:20 2006 -0800
+++ b/audacious/mainwin.c	Sun Nov 05 13:55:21 2006 -0800
@@ -1950,10 +1950,12 @@
          * In any case the string to match should _never_ contain
          * something the user can't actually see in the playlist.
          */
-        if (words[0])
+        if ((words[0] == NULL || words[0][0] == '\0') ||
+            (words[0] != NULL && words[0][0] != '\0' && words[0][1] == '\0' && 
+             strchr(title, words[0][0])))
+            match = TRUE;
+        else if (strlen(words[0]) > 1)
             match = mainwin_jump_to_file_match(title, words);
-        else
-            match = TRUE;
 
         if (match) {
             gchar *song_index_str = g_strdup_printf("%d", song_index + 1);