-
-
Notifications
You must be signed in to change notification settings - Fork 402
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] - Removed reference counted pointers from JsValue
variants
#1866
Conversation
Test262 conformance changesVM implementation
|
Codecov Report
@@ Coverage Diff @@
## main #1866 +/- ##
==========================================
+ Coverage 46.65% 46.69% +0.03%
==========================================
Files 204 204
Lines 16706 16718 +12
==========================================
+ Hits 7795 7806 +11
- Misses 8911 8912 +1
Continue to review full report at Codecov.
|
Actually, I think this will reduce the performance when doing clones of |
Benchmark for f2ee903Click to view benchmark
|
@@ -554,7 +554,7 @@ impl<'b> ByteCompiler<'b> { | |||
)), | |||
Const::Int(v) => self.emit_push_integer(*v), | |||
Const::Num(v) => self.emit_push_rational(*v), | |||
Const::BigInt(v) => self.emit_push_literal(Literal::BigInt(v.clone())), | |||
Const::BigInt(v) => self.emit_push_literal(Literal::BigInt(v.clone().into())), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the only place where I see that it will actually be less performant.
Benchmark for ea9fc25Click to view benchmark
|
Benchmark for 845144eClick to view benchmark
|
Wow performance seems pretty bad |
I'm curious if the cause was moving the internal |
I don't see how this could have an impact. From the unsafe code guide: Other than the layout is there anything that could be affected by the struct definition? |
Nope, that structure should be exactly the same. But the issue is that calling Something I also noticed is that we clone tokens too much. We should have a |
Benchmark for 16437d8Click to view benchmark
|
It also modifies the `JsObject` variant so that it has a similar structure to other variants, where the internal structure is private.
Benchmark for e6ea8bdClick to view benchmark
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good from my side :)
bors r+ |
This Pull Request fixes/closes #1864. It changes the following: - Removed `JsBigInt` from `Const` nodes, using a boxed `BigInt` instead. - Modifies the `JsObject` variant so that it has a similar structure to other variants, where the internal structure is private. The size of `JsValue` stays in 2 64-bit words (in a 64-bit system at least), and the size of `Const` also stays the same. I have noticed that we clone tokens too much in the parser, so I was thinking that we should implement a by-value getter for `kind()`. Something like `kind_unwrap()`.
Pull request successfully merged into main. Build succeeded: |
JsValue
variantsJsValue
variants
This Pull Request fixes/closes #1864.
It changes the following:
JsBigInt
fromConst
nodes, using a boxedBigInt
instead.JsObject
variant so that it has a similar structure to other variants, where the internal structure is private.The size of
JsValue
stays in 2 64-bit words (in a 64-bit system at least), and the size ofConst
also stays the same.I have noticed that we clone tokens too much in the parser, so I was thinking that we should implement a by-value getter for
kind()
. Something likekind_unwrap()
.