commit 52b2ee9d64f0bcc94a4e51797e4fbb7fffa3d2b4
parent ba8693554ce96dce515859406227ddeb5d19af86
Author: Bharatvaj Hemanth <bharatvaj@yahoo.com>
Date: Tue, 13 Oct 2026 21:38:02 +0530
parent ba8693554ce96dce515859406227ddeb5d19af86
Author: Bharatvaj Hemanth <bharatvaj@yahoo.com>
Date: Tue, 13 Oct 2026 21:38:02 +0530
Bound filtering work for huge streams
diff --git a/HACKING b/HACKING @@ -97,5 +97,6 @@ Known simplifications - The ListBox displays at most LIST_LIMIT rows. This keeps huge streams (for example 100MB+ logs) responsive instead of trying to shove every line into a Win32 list control. -- Filtering stops after LIST_LIMIT matches. This intentionally favors staying - interactive over exhaustive ranking on massive inputs. +- Filtering scans at most SCAN_LIMIT rows and stops after LIST_LIMIT matches. + This intentionally favors staying interactive over exhaustive ranking on + massive inputs.
diff --git a/wmenu.c b/wmenu.c @@ -23,6 +23,7 @@ #define WM_STDIN_CHUNK (WM_APP + 1) #define WM_STDIN_DONE (WM_APP + 2) #define LIST_LIMIT 1000 +#define SCAN_LIMIT 50000 #define CHUNK_LINES 2048 static int dpi = 96; @@ -139,7 +140,8 @@ static void refill_list(const char *query) ++n; } } else { - for (int i = 0; i < item_count && n < LIST_LIMIT; ++i) { + int scan = item_count < SCAN_LIMIT ? item_count : SCAN_LIMIT; + for (int i = 0; i < scan && n < LIST_LIMIT; ++i) { if (has_match(query, items[i])) { ranked[n].index = i; ranked[n++].score = match(query, items[i]);
: nply/wmenu