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(mongodb): single-pass tokenizer in MqlParser._normalizeJsObject eliminating repeated string copying #1539
In MqlParser._normalizeJsObject (lib/features/mongodb/mql_parser.dart):
Runs three replaceAllMapped passes with dynamic RegExps.
Replaces string literals with placeholders (@@@STR_0@@@, @@@STR_1@@@).
Iterates over placeholders with processed = processed.replaceAll('@@@STR_$i@@@', strings[i]).
For a query containing 50 strings, replaceAll creates 50 complete copies of the entire query string in heap.
Solution
Replace the multi-pass placeholder mechanism with a single-pass tokenizer/scanner streaming normalized JSON into a StringBuffer.
Quote keys and preserve string literals in one linear scan (N)$ without intermediate query re-allocations.
Benefits
Single linear pass (N)$ with zero repeated string cloning.
Significantly faster MQL parsing for batch inserts and complex queries.
Activity
fix(mongodb): one-pass normalisation of mongosh object literals (#1513,
docs(changelog): today's entries; test: calc bar test after #1674 (de…