You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
perf(grid): eliminate dynamic RegExp compilations and substring allocations in GridFilterEngine #1527
In GridFilterEngine (lib/features/workspace/grid_filter_engine.dart), tokenize and _tryMatchPredicate are triggered on every keystroke in the grid filter bar.
On every step of the tokenization loop:
input.substring(i) is called, allocating a new string.
Over 9 RegExp instances are dynamically instantiated and compiled (AND|&&, OR|||, NOT|!, IS NULL, IN, BETWEEN, LIKE, comparisons, identifiers).
For a moderate filter query, this generates ~50 temporary string allocations and ~60 dynamic regex compilations per keystroke, causing typing latency.
Solution
Replace input.substring(i) with index-based checks (input.startsWith('AND', i) or codeUnitAt).
Match comparison operators (>=, <=, !=, <>, ==, =, >, <) using branch logic or static table rather than dynamic regex.
Precompile all keyword patterns into static final fields or replace with zero-allocation character scanners.
Benefits
Zero regex compilations during keystroke tokenization.
Instant feedback in grid search bar with negligible GC churn.
Fixed on dev by f19b07a: perf(grid): read the filter input by offset with precompiled patterns. It reaches main with the next dev to main merge (closed after checking the code and its tests).
Activity
Merge pull request #1607 from QueryaHub/issue/1527-grid-filter-engine
ZhuchkaTriplesix commentedon Oct 25, 2026
Fixed on dev by f19b07a: perf(grid): read the filter input by offset with precompiled patterns. It reaches main with the next dev to main merge (closed after checking the code and its tests).