oxc-project
oxc
BlogDocsChangelog

perf(codegen): write indent in chunks of 32 bytes

#12745Merged
Comparing
08-02-perf_codegen_write_indent_in_chunks_of_32_bytes
(
e8ac1a5
) with
main
(
5d96425
)
CodSpeed Performance Gauge
0%
Untouched
34

Benchmarks

Passed

semantic[react.development.js]
tasks/benchmark/benches/semantic.rs::semantic::bench_semantic
CodSpeed Performance Gauge
0%
1.7 ms1.7 ms
semantic[binder.ts]
tasks/benchmark/benches/semantic.rs::semantic::bench_semantic
CodSpeed Performance Gauge
0%
4.3 ms4.3 ms
semantic[RadixUIAdoptionSection.jsx]
tasks/benchmark/benches/semantic.rs::semantic::bench_semantic
CodSpeed Performance Gauge
0%
76.7 µs76.6 µs
formatter[binder.ts]
tasks/benchmark/benches/formatter.rs::formatter::bench_formatter
CodSpeed Performance Gauge
0%
21.3 ms21.3 ms
lexer[RadixUIAdoptionSection.jsx]
tasks/benchmark/benches/lexer.rs::lexer::bench_lexer
CodSpeed Performance Gauge
0%
20.9 µs20.9 µs
minifier[cal.com.tsx]
tasks/benchmark/benches/minifier.rs::minifier::bench_minifier
CodSpeed Performance Gauge
0%
39.1 ms39.1 ms
parser[RadixUIAdoptionSection.jsx]
tasks/benchmark/benches/parser.rs::parser::bench_parser
CodSpeed Performance Gauge
0%
84.3 µs84.2 µs
formatter[RadixUIAdoptionSection.jsx]
tasks/benchmark/benches/formatter.rs::formatter::bench_formatter
CodSpeed Performance Gauge
0%
307.9 µs307.7 µs
transformer[binder.ts]
tasks/benchmark/benches/transformer.rs::transformer::bench_transformer
CodSpeed Performance Gauge
0%
1.7 ms1.7 ms
semantic[cal.com.tsx]
tasks/benchmark/benches/semantic.rs::semantic::bench_semantic
CodSpeed Performance Gauge
0%
28 ms28 ms
formatter[react.development.js]
tasks/benchmark/benches/formatter.rs::formatter::bench_formatter
CodSpeed Performance Gauge
0%
10.6 ms10.6 ms
codegen[binder.ts]
tasks/benchmark/benches/codegen.rs::codegen::bench_codegen
CodSpeed Performance Gauge
0%
4.2 ms4.2 ms
linter[cal.com.tsx]
tasks/benchmark/benches/linter.rs::linter::bench_linter
CodSpeed Performance Gauge
0%
1.2 s1.2 s
linter[RadixUIAdoptionSection.jsx]
tasks/benchmark/benches/linter.rs::linter::bench_linter
CodSpeed Performance Gauge
0%
2.5 ms2.5 ms
formatter[cal.com.tsx]
tasks/benchmark/benches/formatter.rs::formatter::bench_formatter
CodSpeed Performance Gauge
0%
169.5 ms169.5 ms
transformer[react.development.js]
tasks/benchmark/benches/transformer.rs::transformer::bench_transformer
CodSpeed Performance Gauge
0%
714.4 µs714.3 µs
parser[react.development.js]
tasks/benchmark/benches/parser.rs::parser::bench_parser
CodSpeed Performance Gauge
0%
1.3 ms1.3 ms
linter[react.development.js]
tasks/benchmark/benches/linter.rs::linter::bench_linter
CodSpeed Performance Gauge
0%
52.1 ms52.1 ms
linter[binder.ts]
tasks/benchmark/benches/linter.rs::linter::bench_linter
CodSpeed Performance Gauge
0%
146.3 ms146.3 ms
estree[checker.ts]
tasks/benchmark/benches/parser.rs::parser::bench_estree
CodSpeed Performance Gauge
0%
104.6 ms104.6 ms
parser[cal.com.tsx]
tasks/benchmark/benches/parser.rs::parser::bench_parser
CodSpeed Performance Gauge
0%
26.8 ms26.8 ms
lexer[cal.com.tsx]
tasks/benchmark/benches/lexer.rs::lexer::bench_lexer
CodSpeed Performance Gauge
0%
5.8 ms5.8 ms
codegen[react.development.js]
tasks/benchmark/benches/codegen.rs::codegen::bench_codegen
CodSpeed Performance Gauge
0%
2 ms2 ms
isolated-declarations[vue-id.ts]
tasks/benchmark/benches/transformer.rs::transformer::bench_isolated_declarations
CodSpeed Performance Gauge
0%
57.5 ms57.5 ms
lexer[binder.ts]
tasks/benchmark/benches/lexer.rs::lexer::bench_lexer
CodSpeed Performance Gauge
0%
929.9 µs930 µs
lexer[react.development.js]
tasks/benchmark/benches/lexer.rs::lexer::bench_lexer
CodSpeed Performance Gauge
0%
384 µs384.1 µs
parser[binder.ts]
tasks/benchmark/benches/parser.rs::parser::bench_parser
CodSpeed Performance Gauge
0%
3.3 ms3.3 ms
transformer[RadixUIAdoptionSection.jsx]
tasks/benchmark/benches/transformer.rs::transformer::bench_transformer
CodSpeed Performance Gauge
0%
133.3 µs133.4 µs
codegen[RadixUIAdoptionSection.jsx]
tasks/benchmark/benches/codegen.rs::codegen::bench_codegen
CodSpeed Performance Gauge
0%
128.3 µs128.4 µs
minifier[react.development.js]
tasks/benchmark/benches/minifier.rs::minifier::bench_minifier
CodSpeed Performance Gauge
0%
2.7 ms2.7 ms
codegen[cal.com.tsx]
tasks/benchmark/benches/codegen.rs::codegen::bench_codegen
CodSpeed Performance Gauge
0%
36.9 ms37 ms
minifier[RadixUIAdoptionSection.jsx]
tasks/benchmark/benches/minifier.rs::minifier::bench_minifier
CodSpeed Performance Gauge
0%
81.2 µs81.4 µs
minifier[binder.ts]
tasks/benchmark/benches/minifier.rs::minifier::bench_minifier
CodSpeed Performance Gauge
0%
4.9 ms4.9 ms
transformer[cal.com.tsx]
tasks/benchmark/benches/transformer.rs::transformer::bench_transformer
CodSpeed Performance Gauge
-1%
26.4 ms26.8 ms

Commits

Click on a commit to change the comparison range
Base
main
5d96425
-0.04%
perf(codegen): write indent in chunks of 32 bytes (#12745) #12691 added the option to write indentation as either tabs or spaces. This changed 2 things about writing indentation: 1. On x86_64, it now takes 3 SIMD instructions to "splat" the indent character across a 16-byte XMM register. Previously it was a 16-byte XMM read from a static. 2. If using spaces as indent, it'll usually be in width of 2 or 4. The indent printer has a fast path for writing less than 16 bytes of indentation. When using a single tab as indent, it's rare you'd write more than 16 bytes, because code is rarely that deeply nested. But if using 4 spaces as indent, depth only needs to get to 5 to exceed 16 bytes, which is not uncommon. This makes hitting the slow path far more likely. Therefore, increase the size of chunks of indentation that's written on the fast path to 32 bytes. This adds only one more XMM write, because it can reuse the "splatted" XMM register, and makes it less likely to hit the slow path. It's not possible to optimize for all cases because tabs and spaces indentation are quite different in this respect, but I think increasing the chunk size to 32 is probably a decent "middle of the road" option. Seems to have no ill effects on our benchmarks, which use tabs for indentation. So this seems not to hurt the tabs case, but should help the 4 x spaces case significantly.
e8ac1a5
3 months ago
by overlookmotel
© 2025 CodSpeed Technology
Home Terms Privacy Docs