Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf(span): align Span same as usize #8298

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

overlookmotel
Copy link
Contributor

@overlookmotel overlookmotel commented Jan 6, 2025

Span consists of 2 x u32 (8 bytes total). Align Span on 8 bytes on 64-bit platforms. This means that, on 64-bit platforms, Span can be treated as equivalent to a u64 and stored in a single register (instead of requiring 2).

A side-effect is that all AST structs also become aligned on 8. This will be a useful property later on as we can remove alignment calculations from Allocator::alloc (since everything now has same alignment).

BooleanLiteral (and BoundaryAssertion, CharacterClassEscape and IndexedReference from oxc_regular_expression crate) increase from 12 bytes to 16 bytes due to the higher alignment. But this makes no practical difference as they'd almost always end up with padding around them in arena anyway, as they'll be surrounded by 8-aligned types.

@github-actions github-actions bot added A-ast Area - AST A-ast-tools Area - AST tools labels Jan 6, 2025
Copy link
Contributor Author

overlookmotel commented Jan 6, 2025


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.

@github-actions github-actions bot added the C-performance Category - Solution not expected to change functional behavior, only performance label Jan 6, 2025
Copy link

codspeed-hq bot commented Jan 6, 2025

CodSpeed Performance Report

Merging #8298 will improve performances by 4.92%

Comparing 01-03-perf_span_align_span_same_as_usize_ (1b5a978) with main (d8b27af)

Summary

⚡ 1 improvements
✅ 28 untouched benchmarks

Benchmarks breakdown

Benchmark main 01-03-perf_span_align_span_same_as_usize_ Change
isolated-declarations[vue-id.ts] 725.1 ms 691.1 ms +4.92%

@overlookmotel overlookmotel marked this pull request as ready for review January 6, 2025 14:16
@overlookmotel overlookmotel marked this pull request as draft January 6, 2025 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ast Area - AST A-ast-tools Area - AST tools 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