Skip to content

Comments

perf(ast/estree): faster JSON serialization of empty arrays#9896

Closed
overlookmotel wants to merge 1 commit into03-19-perf_ast_estree_speed_up_raw_deser_for_jsxelement_from
03-19-perf_ast_estree_faster_json_serialization_of_empty_arrays
Closed

perf(ast/estree): faster JSON serialization of empty arrays#9896
overlookmotel wants to merge 1 commit into03-19-perf_ast_estree_speed_up_raw_deser_for_jsxelement_from
03-19-perf_ast_estree_faster_json_serialization_of_empty_arrays

Conversation

@overlookmotel
Copy link
Member

@overlookmotel overlookmotel commented Mar 19, 2025

#9863 hurt performance of serializing AST to JSON by 8%. This may just have been that Identifiers are so common that adding more bulk to them is costly. But it might also be that serializing [(); 0] is expensive.

Introduce an EmptyArray object which is as fast as possible to serialize.

Let's see if it helps...

@github-actions github-actions bot added A-ast Area - AST C-performance Category - Solution not expected to change functional behavior, only performance labels Mar 19, 2025
Copy link
Member Author

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@overlookmotel overlookmotel marked this pull request as ready for review March 19, 2025 12:03
@overlookmotel overlookmotel marked this pull request as draft March 19, 2025 12:03
@codspeed-hq
Copy link

codspeed-hq bot commented Mar 19, 2025

CodSpeed Performance Report

Merging #9896 will not alter performance

Comparing 03-19-perf_ast_estree_faster_json_serialization_of_empty_arrays (dd9c1d0) with 03-19-perf_ast_estree_speed_up_raw_deser_for_jsxelement_ (78d3dd1)

Summary

✅ 33 untouched benchmarks

@overlookmotel
Copy link
Member Author

Makes no difference. The perf regression must just have been due to adding weight to every Identifier.

@Boshen Boshen deleted the 03-19-perf_ast_estree_faster_json_serialization_of_empty_arrays branch August 30, 2025 05:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-ast Area - AST C-performance Category - Solution not expected to change functional behavior, only performance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant