Optimize search highlight lookups for scroll performance#24
Open
kdkavanagh-agent wants to merge 2 commits intomasterfrom
Open
Optimize search highlight lookups for scroll performance#24kdkavanagh-agent wants to merge 2 commits intomasterfrom
kdkavanagh-agent wants to merge 2 commits intomasterfrom
Conversation
Parametrized tests measuring scroll performance with active search highlights vs baseline across different search cardinalities (single match, sparse, adjacent block, dense) and screen sizes (120x30, 800x200, 3000x1000). Tests fail if search scrolling is >15% slower. Configured pytest-xdist with -n 2 for parallel execution. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ries Convert active_search_queue lookups from O(n) list scans to O(1) set lookups for per-row color checks, and cache a Polars Series to avoid rebuilding from a Python list on every render call to is_in(). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Optimizes search highlight performance by converting internal data structures for O(1) lookups:
_search_set(set) — Used in_get_sel_col_bg_color()for O(1) membership tests instead of O(n) linear scan on the Python list_search_series(pl.Series) — Pre-computed Polars Series passed tois_in()so Polars doesn't rebuild from a Python list on every render callwatch_active_search_queue()— Reactive watcher rebuilds both cached structures only when the search queue changesThe original
active_search_queuelist is preserved unchanged, son/Nsearch iteration order is unaffected.Performance Results
Slowdown = (search_scroll_time - baseline_scroll_time) / baseline_scroll_time. Threshold: 15%.
All 12 tests pass (threshold: 15%). Previously dense_most_rows at 800x200 was intermittently failing at 15-16%.
Test plan
Generated with Claude Code