Skip to content

perf: inline base64 encode lookup in VLQ encoder#34

Open
7rulnik wants to merge 1 commit intopatch-0.6.1from
perf/inline-vlq-encode-lookup
Open

perf: inline base64 encode lookup in VLQ encoder#34
7rulnik wants to merge 1 commit intopatch-0.6.1from
perf/inline-vlq-encode-lookup

Conversation

@7rulnik
Copy link
Copy Markdown
Owner

@7rulnik 7rulnik commented Feb 1, 2026

Summary

  • Inline the base64 encode lookup in the VLQ encoder to reduce overhead.

Benchmarks

Command: yarn bench

Case Parsing (ms) Serializing (ms)
Base (patch-0.6.1) 367.397 (n=68, σ=13.92) 226.072 (n=111, σ=13.01)
This PR 361.420 (Δ -1.63%) 216.414 (Δ -4.27%)

Use direct string indexing instead of function call to base64.encode().
Avoids function call overhead and bounds check in hot serialization path.

Benchmark shows ~8.5% serialization improvement (~19ms on 2.35M mappings).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant