Files
regex-tools/docs/PERFORMANCE.md

67 lines
3.9 KiB
Markdown

# Performance
Live parsing is debounced by 120 ms and live execution by 220 ms. Live runs use
a 250 ms wall-clock limit; manual runs default to 2 seconds and can be raised to
the configured 10-second maximum.
Tests exercise bounded parsing, execution, zero-length iteration, result
truncation and worker recovery. Browser performance depends on hardware,
browser, engine version, pattern and subject. The UI therefore reports observed
elapsed time and exact runtime identity but makes no universal throughput or
safety claim.
The production bundle separates syntax and execution workers. Interactive
syntax/extraction trees and editor decoration sets render at most 2,000 items
each and report both the rendered and actual totals. These are presentation
limits only: normalized syntax, exact ranges and bounded engine results remain
available to the capture table and eligible exports.
Replacement templates have a 64 Ki UTF-16 input limit. Every token below that
limit remains in the syntax model; the editor decorates at most 2,000 tokens,
the token list renders 500 rows, and at most 200 replacement diagnostics
(including an omission summary) cross into the UI. List templates have a 16 Ki
UTF-16 input limit and render 250 token chips.
The per-match replacement view renders at most 200 matches and 2,000
contributions, with a combined 50,000 token-evaluation budget. Original,
replacement and individual contribution text are previewed separately from the
bounded output.
Capture rows are collected under the central 100,000-row limit and rendered in
pages of 200. Individual result-value previews are capped at 64 Ki UTF-16 units
and share an 8 Mi-unit aggregate engine-result budget. The extraction tree
shows 100 UTF-16 units per value and capture-table cells show 512, with explicit
range lengths and separate engine-prefix labels; copy and eligible JSON export
retain the bounded engine value. List export is disabled when a source value is incomplete, so a bounded
preview cannot be mistaken for the full value. List generation additionally
stops at 250,000 template-token evaluations, a 64 Ki UTF-16 row preview, or an
8 Mi-unit aggregate materialization bound. The UI shows 500 list rows while an
eligible export still contains every generated row; any incomplete result
disables export.
Replacement output has a separate 64 MiB bound. Match/capture-limit
incompleteness and output-byte truncation are tracked separately; either makes
the aggregate replacement result incomplete.
Unit-test cases run through supervisors separate from the interactive workers.
Each case uses its configured timeout, cancellation kills the active worker,
and the suite has a 60-second aggregate wall limit. Suite state is capped at
1,000 cases; add, clone, current-result capture and JSON append-import all
enforce that cap and preflight a 32 MiB aggregate in-memory suite bound. Test
names, patterns, subjects, replacement templates and expected values have
explicit per-field limits; subjects must also fit the execution engine's UTF-8
byte cap. Failure diagnostics preview only bounded portions of expected and
actual values and retain at most 2 KiB UTF-8 per result, keeping 1,000 result
messages below the 2 MiB log budget. A complete replacement output above the
expected-value or aggregate-suite limit is not copied into draft state; a
lightweight `should-match` draft is offered when applicable.
Project import, export and local save have a 32 MiB aggregate UTF-8 JSON limit
in addition to field-specific limits. Standalone test-suite import has the same
32 MiB pre-parse file/document limit. Export and save count the indented JSON
representation against a byte budget before materializing or writing it.
IndexedDB schema version 2 indexes `updatedAt`; latest-project loading opens one
descending cursor and validates only that record instead of calling `getAll()`.
Formal cold/warm benchmarks, p95 statistics and growth charts are deferred to
the analysis milestone and will run in killable workers.