This commit addresses a critical performance issue where empty or
whitespace-only search queries in the TextHighlight widget were causing
excessive creation of MatchedElement instances. The fix includes:
Rewriting the sort function to sortAndFilter
Filtering out map entries with empty keys or keys that become empty when trimmed
Implementing this filter at the earliest possible stage to prevent downstream issues
Performance improvements:
Significantly reduced memory usage and processing time for empty or invalid queries
Improved overall efficiency by eliminating unnecessary computations
Also includes additional unit tests to prevent regression and ensure
proper handling of edge cases.
This commit addresses a critical performance issue where empty or whitespace-only search queries in the TextHighlight widget were causing excessive creation of MatchedElement instances. The fix includes:
Performance improvements:
Also includes additional unit tests to prevent regression and ensure proper handling of edge cases.
Fixes #51