Repository navigation
Value refactor - #498
Value refactor#498
Value refactor#498Conversation
Codecov Report
@@ Coverage Diff @@
## master #498 +/- ##
==========================================
+ Coverage 67.88% 68.06% +0.18%
==========================================
Files 165 169 +4
Lines 9932 9918 -14
==========================================
+ Hits 6742 6751 +9
+ Misses 3190 3167 -23
Continue to review full report at Codecov.
|
Benchmark for 20b71c0Click to view benchmark
|
|
Woww. The benchmarks are awesome. I did not expect that big of an improvement from an initial refactor of |
|
Apparently |
a2b8600 to
935ac2a
Compare
Benchmark for 0813346Click to view benchmark
|
Benchmark for b160799Click to view benchmark
|
Benchmark for 9f00b7cClick to view benchmark
|
|
Size of |
fd7ceff to
fc1a8d8
Compare
Benchmark for de07dc4Click to view benchmark
|
Benchmark for d5b34c3Click to view benchmark
|
a3b996d to
2ef288a
Compare
15f6b21 to
1d179d5
Compare
Benchmark for 5dff5c7Click to view benchmark
|
Benchmark for f7daf82Click to view benchmark
|
Benchmark for aab0800Click to view benchmark
|
|
This is ready for review :) @Razican @jasonwilliams |
c035f1a to
d5025e2
Compare
Benchmark for 62c19c0Click to view benchmark
|
d5025e2 to
02e8ce4
Compare
Benchmark for aebb26eClick to view benchmark
|
|
I did a profile of The profile for |
|
|
||
| /// _fn(this, arguments, ctx) -> ResultValue_ - The signature of a built-in function | ||
| pub type NativeFunctionData = fn(&mut Value, &[Value], &mut Interpreter) -> ResultValue; | ||
| pub type NativeFunctionData = fn(&Value, &[Value], &mut Interpreter) -> ResultValue; |
There was a problem hiding this comment.
Whats the reason behind the change here?
There was a problem hiding this comment.
Whats the reason behind the change here?
It's because the Value does not need to be mutable itself, except Object and Object is covered in a GcCell<...> it has interior mutability, so we can borrow_mut the Object with a immutable reference to Value.
This eliminated some places where we were awkwardly cloning the value and passing it to a function because the builtin function required it (&mut value.clone()), instead of just passing the value direclty.
Razican
left a comment
There was a problem hiding this comment.
Wow, benchmarks are amazing!! 80% reduction in arithmetic operations is crazy!
Check my comments, they are mostly a bit of cleanup, part of it not even related to the PR. I think this code is very good!
Benchmark for 6de3aecClick to view benchmark
|
- Refactor `String` => `Rc<str>` - Refactor `Symbol` => `Rc<Symbol>` - Refactor `BigInt` => `RcBigInt` - Changed function signature, from `&mut Value` to `&Value` - Removed `Interpreter::value_to_rust_number() - Abstracted `Gc<GcCell<Object>>` to `GcObject` - Removed unnecessary `Box`s in global environment - Extracted `extensible` from internal slots - Made `to_primitive` throw errors - Removed `strict` parameter in `SameValue` function. - The `SameValue` function is not dependent on strict mode.
765e0ae to
ca0fa50
Compare
Benchmark for f951c8fClick to view benchmark
|
|
Lets merge this :) |


This Pull Request fixes/closes #465
It changes the following:
Gc<...>=>Value::Object(Gc<GcCell<Object>>)ValueData=>ValueRcString,RcSymbol,RcBigIntValue::String(String)=>Value::String(RcString)Value::Symbol(Symbol)=>Value::Symbol(RcSymbol)Value::BigInt(BigInt)=>Value::BigInt(RcBigInt)Gc<GcCell<Object>>=>GcObjectValuesize from40bytes =>24bytesthis, from&mut Value=>&ValueInterpreter::value_to_rust_number()Boxs in global environmentextensibleforinternal_slotsto_primitive,ordinary_to_primitiveandValue::equalsthrow errors.strictparameter ofSameValue(it is not dependent on strict mode)