XPerf
LanguagesJavaScriptEvidence

jp-map-filter-chain — measured, still hint

Status

hint. Wall-clock JSONL: jp-map-filter-chain.jsonl. Not corpus-triaged. The 2026-10-22 corpus verdict does not cover this slug.

Measurement

examples/bench/evidence_jp005_jp006.js. Nine rounds after three warm-up runs; median. Both sides build the result array and sum it. Node v24.18.0, V8 13.6.233.17-node.50.

ratio is chain time / one-pass time. The cost grows with the length and with how many passes you make.

rolecasemedian_msopsratio
before3 rows, filter then map, × 200000.289600001.276
afterone pass0.226600001
before3 rows, four filters then map, × 200000.761600003.460
afterone pass0.220600001
before100 rows, filter then map, × 20000.5042000001.228
afterone pass0.4102000001
before100 rows, four filters then map, × 20001.0262000002.487
afterone pass0.4132000001
before35000 rows, filter then map, × 208.7287000004.598
afterone pass1.8987000001
before35000 rows, four filters then map, × 2012.8507000009.841
afterone pass1.3067000001

A 3-row filter then map is 1.28×, under the about-2× bar. Four passes on 3 rows is 3.46×, and 20000 calls still finish in 0.76 ms. On 35000 rows one pass is about 4.6× (one filter) and about 9.8× (four filters). Those are different costs. The hint says so. It does not say every chain must be rewritten.

The matcher strips // comments and block comments before it looks. It does not know the array length, and it does not require a loop. A generated gen-* file is still skipped.

Unblock

Do not set the default to error from this file alone. A short array, a cold path, or another engine can erase the difference. Corpus triage is still required before any default change.