Generate direct string lengths and unit-step slices
Closed
AL
8d ago+152+152+012345678901234567890123456789-10-10-01234567890123456789
String Var lengths and ordinary slices currently split the entire string into an array first. Generate direct .length and .slice(start, stop) calls for omitted or constant integer unit steps, avoiding whole-string array allocation. Preserve current UTF-16 code-unit behavior and source/boundary Var metadata; other steps keep the existing array path.
Validation:
- Four generated-expression regression cases failed on the unchanged base.
- Full unit suite: 8,305 passed, 18 skipped; 75.95% coverage.
- Tests execute the generated JavaScript against empty strings, non-BMP/combining characters, lone surrogates, negative/out-of-range dynamic bounds, and omitted/unit steps.
- Source and boundary hooks/imports are checked independently; existing stepped-slice behavior remains covered.
- Added three CodSpeed Python expression-generation benchmarks. These do not measure browser rendering.
- Repository-wide Ruff lint/format and
pyright reflex testspassed.
No new public API. Based directly on main, independent of the other performance changes.