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

[Merged by Bors] - Shrink objects by using ThinVecs #2752

Closed
wants to merge 1 commit into from

Conversation

HalidOdat
Copy link
Member

@HalidOdat HalidOdat commented Mar 27, 2023

The fields like [[PrivateElements]] are hardly used but they occupy 24 bytes (on 64-bit arch.) the ThinVec type stores the len and cap right before the elements (like our JsString implementation) and only a pointer is kept (if not used it does not allocate!), was going to use this in #2723 , since it uses a Vec as a dense storage, but the PR is already too big.

It changes the following:

  • Shrink object from 328 to 288 bytes (40 bytes reduction)
  • Add the thin_vec lightweight crate (single file)

@HalidOdat HalidOdat added performance Performance related changes and issues execution Issues or PRs related to code execution labels Mar 27, 2023
@HalidOdat HalidOdat added this to the v0.17.0 milestone Mar 27, 2023
@github-actions
Copy link

Test262 conformance changes

Test result main count PR count difference
Total 94,277 94,277 0
Passed 71,094 71,094 0
Ignored 17,324 17,324 0
Failed 5,859 5,859 0
Panics 0 0 0
Conformance 75.41% 75.41% 0.00%

Copy link
Member

@nekevss nekevss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good to me.

Copy link
Member

@jedel1043 jedel1043 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice optimization!

@jedel1043
Copy link
Member

bors r+

bors bot pushed a commit that referenced this pull request Mar 28, 2023
The fields like `[[PrivateElements]]` are hardly used but they occupy `24` bytes (on 64-bit arch.) the `ThinVec` type stores the `len` and `cap` right before the elements (like our `JsString` implementation) and only a pointer is kept (if not used it does not allocate!), was going to use this in #2723 , since it uses a `Vec` as a dense storage, but the PR is already too big.

It changes the following:

- Shrink object from `328` to `288` bytes (40 bytes reduction)
- Add the `thin_vec` lightweight crate (single file)
@bors
Copy link

bors bot commented Mar 28, 2023

Pull request successfully merged into main.

Build succeeded:

@bors bors bot changed the title Shrink objects by using ThinVecs [Merged by Bors] - Shrink objects by using ThinVecs Mar 28, 2023
@bors bors bot closed this Mar 28, 2023
@bors bors bot deleted the optimization/shrink-size-of-object branch March 28, 2023 03:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
execution Issues or PRs related to code execution performance Performance related changes and issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants