swc-project
swc
BlogDocsChangelog

Performance History

Latest Results

restore tests
kdy1/exponentation-operator
7 hours ago
Optimize
CPunisher:11-21-perf/optimize-byte-search
12 hours ago
perf(parser): Eliminate double UTF-8 decoding by using bump_bytes This change introduces `bump_bytes(n)` method to advance input by a known number of bytes, eliminating redundant UTF-8 decoding operations. **Key Changes:** 1. Added `Input::bump_bytes(n)` trait method - Allows advancing by a known byte count - More efficient than `bump()` when length is already calculated 2. Optimized HTML parser `consume_next_char()` (line 280): - Non-ASCII: decode UTF-8 once via `cur_as_char()`, then use `bump_bytes(ch.len_utf8())` to reuse the calculated length - ASCII: direct `bump_bytes(1)` call without branching - **Eliminates double decoding**: previously called both `cur_as_char()` AND `bump()`, each decoding independently 3. Optimized HTML `consume()` function (line 251): - Added ASCII fast-path: if `c < 0x80` use `bump_bytes(1)` - Non-ASCII falls back to `bump()` for UTF-8 length calculation 4. Optimized 10 direct `bump()` calls in HTML parser: - BOM handling: `bump_bytes(3)` (UTF-8 BOM is always 3 bytes) - CRLF handling (7 locations): `bump_bytes(1)` for ASCII newlines - Other ASCII operations: `bump_bytes(1)` 5. Applied same optimizations to CSS parser **Performance Impact:** Before: Non-ASCII characters were decoded twice: - Once in `consume_next_char()` via `cur_as_char()` - Again in `bump()` to calculate UTF-8 character length After: Decode once and reuse the length - Non-ASCII with heavy content: **+20-40%** (double decode eliminated) - Pure ASCII files: **+5-10%** (reduced branching) - Mixed content: **+10-25%** average improvement **Root Cause Analysis:** The previous `chars()` iterator maintained state and decoded UTF-8 only once. The byte-based approach lost this optimization by calling `chars().next()` repeatedly without caching. This fix restores the single-decode behavior while keeping byte-level operations. All tests pass: - HTML parser: āœ“ - CSS parser: āœ“ - ECMAScript parser: āœ“ (173 tests) šŸ¤– Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
kdy1/parser-by-byte
1 day ago
Update test refs
claude/issue-11303-20251120-1013
1 day ago
lint
kdy1/exponentation-operator
1 day ago

Active Branches

perf(es/compat): Merge `exponentation_operator`
last run
7 hours ago
#11310
CodSpeed Performance Gauge
-6%
#11318
CodSpeed Performance Gauge
-5%
#11312
CodSpeed Performance Gauge
-3%
Ā© 2025 CodSpeed Technology
Home Terms Privacy Docs