oxc-project
oxc
Blog
Docs
Changelog
Blog
Docs
Changelog
Overview
Branches
Benchmarks
Runs
Performance History
Latest Results
feat(minifier): minify `x ? 1 : 0` to `+x` or `+!!x` (#20594) Closes #20288 Adds numeric conditional expression optimization to the minifier: - `x ? 1 : 0` ā `+x` when `x` is known boolean (saves 3 chars) - `x ? 1 : 0` ā `+!!x` when `x` is unknown type and no parens needed (saves 1 char) - `x ? 0 : 1` ā `+!x` when no parens needed (saves 2 chars) - Skips when parentheses would make the result the same length or longer (e.g., `a+b?1:0`) Profitability checks are based on the lessons from swc-project/swc#9920. Implementation note: uses `DetermineValueType` to check if the test expression is boolean, and a simple `test_needs_parens` helper (matching `BinaryExpression`, `LogicalExpression`, etc.) to determine if wrapping would negate the savings. --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
main
4 hours ago
refactor(lexer): revert `Kind` methods to normal matches (#20655) Partially revert #14410. That PR altered `Kind::is_number` and `Kind::is_any_keyword`, replacing `matches!` on `Kind` variants and method calls with explicit matching on the enum discriminant range e.g. `matches!(self as u8, x if x >= Decimal as u8 && x <= HexBigInt as u8)`. The rationale for the change was improved performance. I was suspicious of the AI's claims that this was a perf improvement, as I assumed that compiler would boil down the code to the same anyway. I asked Claude to generate the ASM before / after and he concluded it makes no difference either way. > The compiler generates identical code - a simple sub + cmp + setb range check in both cases. > > ```asm > // is_number > add dil, 107 > cmp dil, 11 > setb al > ``` > > LLVM recognises that: > > 1. Contiguous matches! variants can be reduced to a range check. > 2. The union of the 4 keyword sub-methods covers a contiguous range, so it merges them into a single range check. > > The commit's claim about "20% fewer instructions" and "better pipeline utilization" is nonsense. The manual `as u8` casts just make the code harder to read for zero benefit. New Claude pretty damning about old Claude! So go back to explicit matches, as it's easier to understand.
main
7 hours ago
refactor(lexer): revert `Kind` methods to normal matches
om/03-23-refactor_lexer_revert_kind_methods_to_normal_matches
7 hours ago
refactor(lexer): revert `Kind` methods to normal matches
om/03-23-refactor_lexer_revert_kind_methods_to_normal_matches
7 hours ago
refactor(lexer): revert `Kind` methods to normal matches
om/03-23-refactor_lexer_revert_kind_methods_to_normal_matches
8 hours ago
perf(allocator): remove op from `StringBuilder::grow_one` (#20650) Remove a bounds check from `StringBuilder::grow_one` (which is used by `StringBuilder::push_ascii_byte`). Rationale is explained in comment added in this PR.
main
10 hours ago
release(crates): oxc v0.122.0 (#20648)
main
10 hours ago
release(apps): oxlint v1.57.0 && oxfmt v0.42.0 (#20649)
main
10 hours ago
Latest Branches
CodSpeed Performance Gauge
0%
refactor(lexer): revert `Kind` methods to normal matches
#20655
8 hours ago
90936b8
om/03-23-refactor_lexer_revert_kind_methods_to_normal_matches
CodSpeed Performance Gauge
0%
perf(allocator): remove op from `StringBuilder::grow_one`
#20650
1 month ago
b8470d3
om/02-20-perf_allocator_remove_op_from_stringbuilder_grow_one_
CodSpeed Performance Gauge
0%
fix(transformer): incorrect output with multiple JSX spread children in automatic mode
#20647
11 hours ago
bab83d5
fix/jsx-multiple-spread-children
Ā© 2026 CodSpeed Technology
Home
Terms
Privacy
Docs