perf(javascript): add javascript benchmark#3562
Merged
chaokunyang merged 13 commits intoapache:mainfrom Apr 14, 2026
Merged
Conversation
pandalee99
approved these changes
Apr 14, 2026
fd813b6 to
1659187
Compare
b07c707 to
b197a3f
Compare
…der reset - Add TypeId.isLeafTypeId() for primitives, string, enum, time, typed arrays - Skip incReadDepth/decReadDepth for leaf fields in struct, collection, map codegen - Reuse DataView in BinaryReader.reset() when underlying buffer is unchanged
- Replace BigInt-based readVarUint36Small with getUint32 fast path, eliminating ~25% of deserialization overhead - Fix getInternalStringDetector to use try/catch require instead of unreliable globalThis.require check, enabling O(1) latin1 detection - Add inline ASCII fast path in stringWithHeaderCompatibly for environments without isStringOneByteRepresentation - Hoist getSerializerById lookups in struct readEmbed/writeEmbed to scope-level consts, removing ~5-8% repeated lookup overhead MediaContent deser: 1174ns -> 600ns (49% faster, now 25% faster than Protobuf) MediaContent ser: 952ns -> 748ns (21% faster, now 5% faster than JSON) MediaContentList deser: 4720ns -> 2657ns (44% faster) MediaContentList ser: 4063ns -> 3325ns (18% faster)
Fory now wins all MediaContent benchmarks: - MediaContent ser: 773ns (was 849ns), faster than JSON 769ns - MediaContent deser: 611ns (was 1075ns), faster than Protobuf 827ns - MediaContentList ser: 3496ns (was 3829ns), faster than JSON 3541ns - MediaContentList deser: 2654ns (was 4993ns), faster than Protobuf 4088ns
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why?
What does this PR do?
Related issues
AI Contribution Checklist
yes/noyes, I included a completed AI Contribution Checklist in this PR description and the requiredAI Usage Disclosure.yes, my PR description includes the requiredai_reviewsummary and screenshot evidence of the final clean AI review results from both fresh reviewers on the current PR diff or current HEAD after the latest code changes.Does this PR introduce any user-facing change?
Benchmark