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] - Lift InternalObjectMethods from Object #2790

Closed
wants to merge 3 commits into from

Conversation

jedel1043
Copy link
Member

@jedel1043 jedel1043 commented Apr 6, 2023

This Pull Request lifts the InternalObjectMethods vtable from Object, which should technically improve performance, since we now won't need to call borrow to use any of the internal methods, but let's see what the benchmarks show.

It changes the following:

  • Adds a new VTableObject struct, containing the old GcRefCell<Object> and the lifted InternalObjectMethods.
  • Changes the definition of JsObject to Gc<VTableObject>. Note that this means the InternalObjectMethods are accessible through the Gc pointer.
  • Reestructures intrinsic initialization and initialization APIs to accommodate this change.

@jedel1043 jedel1043 added Internal Category for changelog run-benchmark Label used to run banchmarks on PRs labels Apr 6, 2023
@jedel1043 jedel1043 added this to the v0.17.0 milestone Apr 6, 2023
@jedel1043 jedel1043 changed the title Lift JsObject internal methods from Object Lift InternalObjectMethods from Object Apr 6, 2023
@github-actions
Copy link

github-actions bot commented Apr 6, 2023

Test262 conformance changes

Test result main count PR count difference
Total 94,781 94,781 0
Passed 71,489 71,489 0
Ignored 17,824 17,824 0
Failed 5,468 5,468 0
Panics 0 0 0
Conformance 75.43% 75.43% 0.00%

@codecov
Copy link

codecov bot commented Apr 6, 2023

Codecov Report

Merging #2790 (1072987) into main (6412b30) will increase coverage by 0.26%.
The diff coverage is 60.46%.

@@            Coverage Diff             @@
##             main    #2790      +/-   ##
==========================================
+ Coverage   51.10%   51.37%   +0.26%     
==========================================
  Files         416      416              
  Lines       41506    41255     -251     
==========================================
- Hits        21213    21195      -18     
+ Misses      20293    20060     -233     
Impacted Files Coverage Δ
boa_engine/src/builtins/typed_array/mod.rs 6.95% <0.00%> (ø)
boa_engine/src/context/mod.rs 47.66% <ø> (ø)
boa_engine/src/vm/opcode/set/class_prototype.rs 93.54% <0.00%> (+12.99%) ⬆️
boa_engine/src/object/mod.rs 33.78% <34.32%> (+4.30%) ⬆️
boa_engine/src/builtins/regexp/mod.rs 67.02% <66.66%> (+0.05%) ⬆️
boa_engine/src/object/jsobject.rs 62.16% <95.45%> (+2.08%) ⬆️
boa_engine/src/builtins/array/mod.rs 77.26% <100.00%> (ø)
boa_engine/src/builtins/error/type.rs 80.00% <100.00%> (ø)
boa_engine/src/builtins/mod.rs 100.00% <100.00%> (ø)
boa_engine/src/builtins/uri/mod.rs 23.59% <100.00%> (ø)
... and 3 more

... and 3 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@github-actions
Copy link

github-actions bot commented Apr 6, 2023

Benchmark for ed2f008

Click to view benchmark
Test Base PR %
Arithmetic operations (Compiler) 539.5±0.47ns 545.5±0.57ns +1.11%
Arithmetic operations (Execution) 475.2±0.23ns 469.0±0.29ns -1.30%
Arithmetic operations (Parser) 7.5±0.02µs 7.4±0.02µs -1.33%
Array access (Compiler) 1697.9±23.88ns 1653.5±8.39ns -2.61%
Array access (Execution) 7.7±0.01µs 7.5±0.02µs -2.60%
Array access (Parser) 16.2±0.03µs 16.3±0.10µs +0.62%
Array creation (Compiler) 2.5±0.00µs 2.5±0.01µs 0.00%
Array creation (Execution) 1140.1±2.54µs 1076.4±1.55µs -5.59%
Array creation (Parser) 19.2±0.04µs 19.3±0.04µs +0.52%
Array pop (Compiler) 4.0±0.01µs 4.1±0.01µs +2.50%
Array pop (Execution) 657.2±0.77µs 628.7±1.69µs -4.34%
Array pop (Parser) 162.4±0.17µs 163.9±0.22µs +0.92%
Boolean Object Access (Compiler) 1169.8±1.60ns 1196.4±5.36ns +2.27%
Boolean Object Access (Execution) 4.0±0.01µs 3.8±0.01µs -5.00%
Boolean Object Access (Parser) 19.6±0.04µs 19.7±0.06µs +0.51%
Clean js (Compiler) 5.1±0.02µs 5.2±0.01µs +1.96%
Clean js (Execution) 619.2±3.40µs 599.9±2.99µs -3.12%
Clean js (Parser) 39.9±0.07µs 40.0±0.08µs +0.25%
Create Realm 407.0±1.35µs 470.5±5.13µs +15.60%
Dynamic Object Property Access (Compiler) 1995.4±3.17ns 1988.5±2.40ns -0.35%
Dynamic Object Property Access (Execution) 4.6±0.02µs 4.5±0.01µs -2.17%
Dynamic Object Property Access (Parser) 14.5±0.03µs 14.6±0.04µs +0.69%
Fibonacci (Compiler) 3.2±0.00µs 3.1±0.00µs -3.13%
Fibonacci (Execution) 1044.8±1.06µs 1030.8±2.86µs -1.34%
Fibonacci (Parser) 22.5±0.04µs 22.9±0.05µs +1.78%
For loop (Compiler) 2.8±0.01µs 2.8±0.00µs 0.00%
For loop (Execution) 16.9±0.04µs 16.4±0.03µs -2.96%
For loop (Parser) 19.2±0.04µs 19.5±0.06µs +1.56%
Mini js (Compiler) 4.5±0.01µs 4.6±0.01µs +2.22%
Mini js (Execution) 575.1±4.25µs 549.0±3.29µs -4.54%
Mini js (Parser) 34.8±0.09µs 35.0±0.05µs +0.57%
Number Object Access (Compiler) 1084.6±4.23ns 1092.4±1.86ns +0.72%
Number Object Access (Execution) 3.1±0.00µs 3.0±0.01µs -3.23%
Number Object Access (Parser) 14.9±0.02µs 15.1±0.09µs +1.34%
Object Creation (Compiler) 1788.3±4.13ns 1768.3±3.66ns -1.12%
Object Creation (Execution) 4.2±0.02µs 4.2±0.01µs 0.00%
Object Creation (Parser) 12.7±0.05µs 12.8±0.06µs +0.79%
RegExp (Compiler) 2.0±0.00µs 2.0±0.05µs 0.00%
RegExp (Execution) 12.1±0.04µs 11.9±0.11µs -1.65%
RegExp (Parser) 13.9±0.04µs 13.9±0.03µs 0.00%
RegExp Creation (Compiler) 1793.6±3.16ns 1760.9±3.09ns -1.82%
RegExp Creation (Execution) 8.5±0.02µs 8.5±0.02µs 0.00%
RegExp Creation (Parser) 11.5±0.05µs 11.8±0.03µs +2.61%
RegExp Literal (Compiler) 2.0±0.00µs 2.0±0.00µs 0.00%
RegExp Literal (Execution) 12.1±0.05µs 11.9±0.05µs -1.65%
RegExp Literal (Parser) 14.9±0.03µs 15.0±0.03µs +0.67%
RegExp Literal Creation (Compiler) 1781.5±1.66ns 1761.1±9.01ns -1.15%
RegExp Literal Creation (Execution) 8.5±0.19µs 8.5±0.02µs 0.00%
RegExp Literal Creation (Parser) 12.5±0.02µs 12.8±0.02µs +2.40%
Static Object Property Access (Compiler) 1809.9±5.09ns 1785.3±2.29ns -1.36%
Static Object Property Access (Execution) 4.5±0.03µs 4.4±0.01µs -2.22%
Static Object Property Access (Parser) 13.8±0.05µs 13.8±0.03µs 0.00%
String Object Access (Compiler) 1533.1±2.43ns 1547.1±4.57ns +0.91%
String Object Access (Execution) 5.7±0.01µs 5.5±0.01µs -3.51%
String Object Access (Parser) 18.9±0.03µs 19.3±0.07µs +2.12%
String comparison (Compiler) 2.6±0.01µs 2.6±0.02µs 0.00%
String comparison (Execution) 3.9±0.02µs 3.8±0.00µs -2.56%
String comparison (Parser) 15.6±0.03µs 15.7±0.03µs +0.64%
String concatenation (Compiler) 2.1±0.01µs 2.0±0.00µs -4.76%
String concatenation (Execution) 3.7±0.02µs 3.5±0.01µs -5.41%
String concatenation (Parser) 10.6±0.04µs 10.7±0.02µs +0.94%
String copy (Compiler) 1714.4±8.52ns 1671.1±3.95ns -2.53%
String copy (Execution) 3.5±0.02µs 3.4±0.01µs -2.86%
String copy (Parser) 8.1±0.06µs 8.1±0.03µs 0.00%
Symbols (Compiler) 1277.0±39.85ns 1265.9±2.27ns -0.87%
Symbols (Execution) 3.5±0.04µs 3.3±0.01µs -5.71%
Symbols (Parser) 6.3±0.03µs 6.3±0.02µs 0.00%

@github-actions
Copy link

github-actions bot commented Apr 6, 2023

Benchmark for 8e418f7

Click to view benchmark
Test Base PR %
Arithmetic operations (Compiler) 697.6±25.50ns 708.2±33.70ns +1.52%
Arithmetic operations (Execution) 552.2±17.05ns 554.9±21.06ns +0.49%
Arithmetic operations (Parser) 8.6±0.45µs 8.7±1.69µs +1.16%
Array access (Compiler) 2.1±0.07µs 2.1±0.07µs 0.00%
Array access (Execution) 9.7±0.56µs 9.0±0.58µs -7.22%
Array access (Parser) 17.8±0.81µs 18.0±1.02µs +1.12%
Array creation (Compiler) 3.1±0.17µs 3.2±0.10µs +3.23%
Array creation (Execution) 1216.9±53.60µs 1196.4±49.91µs -1.68%
Array creation (Parser) 21.8±0.71µs 22.4±1.18µs +2.75%
Array pop (Compiler) 5.0±0.28µs 5.2±0.32µs +4.00%
Array pop (Execution) 728.4±27.19µs 681.2±24.71µs -6.48%
Array pop (Parser) 193.4±8.74µs 199.0±10.27µs +2.90%
Boolean Object Access (Compiler) 1511.8±81.59ns 1539.9±92.93ns +1.86%
Boolean Object Access (Execution) 5.0±0.25µs 4.8±0.32µs -4.00%
Boolean Object Access (Parser) 22.4±1.89µs 21.6±0.79µs -3.57%
Clean js (Compiler) 6.2±0.37µs 6.5±0.26µs +4.84%
Clean js (Execution) 740.7±36.31µs 725.5±39.90µs -2.05%
Clean js (Parser) 47.5±8.44µs 44.6±1.80µs -6.11%
Create Realm 540.1±26.22µs 613.8±48.61µs +13.65%
Dynamic Object Property Access (Compiler) 2.5±0.11µs 2.5±0.11µs 0.00%
Dynamic Object Property Access (Execution) 6.0±0.33µs 5.8±0.50µs -3.33%
Dynamic Object Property Access (Parser) 15.9±0.57µs 16.4±0.95µs +3.14%
Fibonacci (Compiler) 4.0±0.33µs 4.0±0.13µs 0.00%
Fibonacci (Execution) 1360.7±65.28µs 1266.5±44.78µs -6.92%
Fibonacci (Parser) 26.0±1.16µs 25.3±0.76µs -2.69%
For loop (Compiler) 3.6±0.42µs 3.5±0.16µs -2.78%
For loop (Execution) 21.3±0.89µs 19.8±0.88µs -7.04%
For loop (Parser) 22.6±1.28µs 21.7±0.84µs -3.98%
Mini js (Compiler) 5.5±0.19µs 5.6±0.18µs +1.82%
Mini js (Execution) 679.5±32.04µs 657.0±34.30µs -3.31%
Mini js (Parser) 39.8±2.11µs 39.6±1.79µs -0.50%
Number Object Access (Compiler) 1395.4±58.04ns 1375.3±53.60ns -1.44%
Number Object Access (Execution) 3.8±0.13µs 3.7±0.20µs -2.63%
Number Object Access (Parser) 17.1±0.77µs 16.7±0.58µs -2.34%
Object Creation (Compiler) 2.2±0.16µs 2.3±0.11µs +4.55%
Object Creation (Execution) 5.7±0.45µs 5.3±0.33µs -7.02%
Object Creation (Parser) 14.8±1.10µs 14.6±0.62µs -1.35%
RegExp (Compiler) 2.5±0.10µs 2.5±0.09µs 0.00%
RegExp (Execution) 15.9±0.95µs 15.0±0.66µs -5.66%
RegExp (Parser) 15.5±1.09µs 15.6±0.59µs +0.65%
RegExp Creation (Compiler) 2.2±0.09µs 2.2±0.08µs 0.00%
RegExp Creation (Execution) 10.8±0.41µs 10.9±0.56µs +0.93%
RegExp Creation (Parser) 13.2±0.60µs 13.0±0.68µs -1.52%
RegExp Literal (Compiler) 2.5±0.14µs 2.6±0.13µs +4.00%
RegExp Literal (Execution) 15.6±0.63µs 14.8±0.46µs -5.13%
RegExp Literal (Parser) 17.3±0.74µs 17.7±0.83µs +2.31%
RegExp Literal Creation (Compiler) 2.2±0.08µs 2.2±0.11µs 0.00%
RegExp Literal Creation (Execution) 10.7±0.45µs 10.9±0.62µs +1.87%
RegExp Literal Creation (Parser) 14.4±0.57µs 15.0±0.65µs +4.17%
Static Object Property Access (Compiler) 2.3±0.19µs 2.3±0.11µs 0.00%
Static Object Property Access (Execution) 6.0±0.57µs 5.6±0.28µs -6.67%
Static Object Property Access (Parser) 15.9±1.20µs 15.4±0.65µs -3.14%
String Object Access (Compiler) 1909.2±57.22ns 1964.3±123.30ns +2.89%
String Object Access (Execution) 7.0±0.21µs 6.9±0.31µs -1.43%
String Object Access (Parser) 21.3±1.28µs 21.0±0.81µs -1.41%
String comparison (Compiler) 3.2±0.17µs 3.3±0.29µs +3.12%
String comparison (Execution) 5.1±0.40µs 4.8±0.24µs -5.88%
String comparison (Parser) 17.4±0.95µs 17.4±1.35µs 0.00%
String concatenation (Compiler) 2.5±0.12µs 2.6±0.16µs +4.00%
String concatenation (Execution) 4.8±0.53µs 4.6±0.23µs -4.17%
String concatenation (Parser) 11.8±0.44µs 12.0±0.71µs +1.69%
String copy (Compiler) 2.1±0.07µs 2.2±0.16µs +4.76%
String copy (Execution) 4.6±0.37µs 4.4±0.28µs -4.35%
String copy (Parser) 8.9±0.41µs 8.8±0.42µs -1.12%
Symbols (Compiler) 1570.6±80.08ns 1598.6±66.47ns +1.78%
Symbols (Execution) 4.5±0.19µs 4.2±0.17µs -6.67%
Symbols (Parser) 7.0±0.44µs 6.8±0.36µs -2.86%

@jedel1043
Copy link
Member Author

jedel1043 commented Apr 6, 2023

It seems like it slightly improved perf on some tests, but I'll try to run https://bellard.org/quickjs/bench.html to see our current perf score.

@jedel1043
Copy link
Member Author

Ok, ran QuickJS's benchmarks and got the following results:

Main

RESULT Richards 29.7
RESULT DeltaBlue 30.3
RESULT Crypto 49.5
RESULT RayTrace 110
RESULT EarleyBoyer 101
RESULT Splay 92.9
RESULT NavierStokes 14.9
SCORE 49.1

PR

RESULT Richards 30.8
RESULT DeltaBlue 31.5
RESULT Crypto 50.3
RESULT RayTrace 112
RESULT EarleyBoyer 103
RESULT Splay 92.7
RESULT NavierStokes 14.4
SCORE 49.7

So it is safe to say the changes did improve performance.

Copy link
Member

@HalidOdat HalidOdat left a comment

Choose a reason for hiding this comment

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

Looks good to me! :)

@raskad
Copy link
Member

raskad commented Apr 7, 2023

Both this and #2723 change the BuiltInBuilders. Do we want to try to merge #2723 first to avoid a huge rebase or is that fine @HalidOdat?

@HalidOdat
Copy link
Member

HalidOdat commented Apr 7, 2023

Both this and #2723 change the BuiltInBuilders. Do we want to try to merge #2723 first to avoid a huge rebase or is that fine @HalidOdat?

I think It's fine, since It's one of the things that needs to be refactored so the builtins work well with shapes

@HalidOdat HalidOdat mentioned this pull request Apr 9, 2023
6 tasks
@jedel1043
Copy link
Member Author

I think It's fine, since It's one of the things that needs to be refactored so the builtins work well with shapes

Yeah, I'd also argue that this PR barely changes the object creation API, so it'll be easier to rebase if the smaller change is merged first.

@github-actions
Copy link

Benchmark for daf4463

Click to view benchmark
Test Base PR %
Arithmetic operations (Compiler) 568.3±1.05ns 567.2±0.96ns -0.19%
Arithmetic operations (Execution) 466.3±2.91ns 442.3±0.31ns -5.15%
Arithmetic operations (Parser) 7.1±0.01µs 7.1±0.01µs 0.00%
Array access (Compiler) 1637.2±3.31ns 1648.4±5.50ns +0.68%
Array access (Execution) 7.2±0.03µs 7.0±0.01µs -2.78%
Array access (Parser) 14.7±0.01µs 14.9±0.01µs +1.36%
Array creation (Compiler) 2.4±0.00µs 2.4±0.01µs 0.00%
Array creation (Execution) 998.1±7.17µs 961.8±2.16µs -3.64%
Array creation (Parser) 17.4±0.04µs 17.7±0.03µs +1.72%
Array pop (Compiler) 4.4±0.02µs 4.4±0.01µs 0.00%
Array pop (Execution) 587.5±5.50µs 578.1±1.09µs -1.60%
Array pop (Parser) 153.8±0.13µs 154.2±0.21µs +0.26%
Boolean Object Access (Compiler) 1201.6±1.66ns 1199.8±3.45ns -0.15%
Boolean Object Access (Execution) 4.8±0.01µs 4.6±0.01µs -4.17%
Boolean Object Access (Parser) 18.3±0.06µs 18.3±0.05µs 0.00%
Clean js (Compiler) 4.8±0.01µs 4.9±0.01µs +2.08%
Clean js (Execution) 772.2±2.64µs 755.0±2.62µs -2.23%
Clean js (Parser) 36.9±0.05µs 37.0±0.03µs +0.27%
Create Realm 427.0±0.94µs 497.4±1.61µs +16.49%
Dynamic Object Property Access (Compiler) 1953.5±4.14ns 1930.9±7.20ns -1.16%
Dynamic Object Property Access (Execution) 4.5±0.01µs 4.4±0.01µs -2.22%
Dynamic Object Property Access (Parser) 13.2±0.01µs 13.1±0.04µs -0.76%
Fibonacci (Compiler) 2.9±0.01µs 3.0±0.01µs +3.45%
Fibonacci (Execution) 1035.4±3.48µs 1030.5±3.84µs -0.47%
Fibonacci (Parser) 20.6±0.03µs 20.7±0.02µs +0.49%
For loop (Compiler) 2.6±0.00µs 2.7±0.01µs +3.85%
For loop (Execution) 15.2±0.02µs 15.2±0.04µs 0.00%
For loop (Parser) 18.1±0.02µs 18.1±0.02µs 0.00%
Mini js (Compiler) 4.3±0.01µs 4.3±0.01µs 0.00%
Mini js (Execution) 729.5±3.50µs 707.5±2.31µs -3.02%
Mini js (Parser) 32.2±0.03µs 32.4±0.03µs +0.62%
Number Object Access (Compiler) 1131.5±1.54ns 1120.6±1.32ns -0.96%
Number Object Access (Execution) 3.7±0.01µs 3.5±0.01µs -5.41%
Number Object Access (Parser) 13.8±0.01µs 13.9±0.01µs +0.72%
Object Creation (Compiler) 1754.4±2.59ns 1739.8±7.74ns -0.83%
Object Creation (Execution) 4.1±0.01µs 4.2±0.01µs +2.44%
Object Creation (Parser) 11.5±0.02µs 11.5±0.04µs 0.00%
RegExp (Compiler) 1944.9±3.86ns 1957.2±4.91ns +0.63%
RegExp (Execution) 12.0±0.02µs 11.6±0.02µs -3.33%
RegExp (Parser) 12.7±0.04µs 12.8±0.01µs +0.79%
RegExp Creation (Compiler) 1723.2±10.75ns 1732.4±7.28ns +0.53%
RegExp Creation (Execution) 8.5±0.02µs 8.1±0.02µs -4.71%
RegExp Creation (Parser) 10.7±0.02µs 10.8±0.02µs +0.93%
RegExp Literal (Compiler) 1934.7±4.18ns 1959.0±6.20ns +1.26%
RegExp Literal (Execution) 11.9±0.03µs 11.6±0.02µs -2.52%
RegExp Literal (Parser) 14.1±0.02µs 13.8±0.02µs -2.13%
RegExp Literal Creation (Compiler) 1718.6±4.78ns 1731.9±8.47ns +0.77%
RegExp Literal Creation (Execution) 8.5±0.01µs 8.1±0.04µs -4.71%
RegExp Literal Creation (Parser) 11.8±0.03µs 11.8±0.02µs 0.00%
Static Object Property Access (Compiler) 1760.9±2.73ns 1750.7±19.25ns -0.58%
Static Object Property Access (Execution) 4.3±0.01µs 4.3±0.01µs 0.00%
Static Object Property Access (Parser) 12.5±0.02µs 12.4±0.02µs -0.80%
String Object Access (Compiler) 1520.2±1.43ns 1516.4±4.01ns -0.25%
String Object Access (Execution) 6.4±0.01µs 6.1±0.01µs -4.69%
String Object Access (Parser) 17.5±0.03µs 17.6±0.02µs +0.57%
String comparison (Compiler) 2.5±0.01µs 2.5±0.01µs 0.00%
String comparison (Execution) 3.8±0.01µs 3.8±0.01µs 0.00%
String comparison (Parser) 14.0±0.02µs 14.2±0.02µs +1.43%
String concatenation (Compiler) 1970.6±11.81ns 1980.8±4.81ns +0.52%
String concatenation (Execution) 3.6±0.01µs 3.4±0.01µs -5.56%
String concatenation (Parser) 9.6±0.03µs 9.6±0.01µs 0.00%
String copy (Compiler) 1598.2±2.33ns 1628.9±4.96ns +1.92%
String copy (Execution) 3.4±0.01µs 3.3±0.01µs -2.94%
String copy (Parser) 7.2±0.01µs 7.3±0.01µs +1.39%
Symbols (Compiler) 1169.0±2.19ns 1190.4±3.85ns +1.83%
Symbols (Execution) 3.6±0.02µs 3.5±0.01µs -2.78%
Symbols (Parser) 5.7±0.02µs 5.7±0.01µs 0.00%

@github-actions
Copy link

Benchmark for 3f8b8e8

Click to view benchmark
Test Base PR %
Arithmetic operations (Compiler) 656.0±1.95ns 665.2±1.86ns +1.40%
Arithmetic operations (Execution) 549.5±2.26ns 532.2±0.50ns -3.15%
Arithmetic operations (Parser) 8.1±0.02µs 7.9±0.01µs -2.47%
Array access (Compiler) 1971.6±3.54ns 1961.6±9.15ns -0.51%
Array access (Execution) 8.5±0.02µs 8.2±0.03µs -3.53%
Array access (Parser) 16.2±0.02µs 15.9±0.05µs -1.85%
Array creation (Compiler) 2.9±0.01µs 2.9±0.01µs 0.00%
Array creation (Execution) 1229.8±12.87µs 1160.2±4.40µs -5.66%
Array creation (Parser) 19.5±0.03µs 19.2±0.06µs -1.54%
Array pop (Compiler) 4.9±0.01µs 5.1±0.02µs +4.08%
Array pop (Execution) 725.2±3.09µs 688.0±4.11µs -5.13%
Array pop (Parser) 173.1±0.36µs 174.9±0.25µs +1.04%
Boolean Object Access (Compiler) 1338.0±2.91ns 1363.7±3.42ns +1.92%
Boolean Object Access (Execution) 5.6±0.01µs 5.4±0.01µs -3.57%
Boolean Object Access (Parser) 20.5±0.05µs 20.3±0.07µs -0.98%
Clean js (Compiler) 5.8±0.01µs 5.8±0.02µs 0.00%
Clean js (Execution) 922.1±2.88µs 895.8±8.16µs -2.85%
Clean js (Parser) 41.1±0.06µs 41.0±0.10µs -0.24%
Create Realm 515.6±1.32µs 597.6±6.79µs +15.90%
Dynamic Object Property Access (Compiler) 2.3±0.01µs 2.3±0.01µs 0.00%
Dynamic Object Property Access (Execution) 5.3±0.01µs 5.1±0.01µs -3.77%
Dynamic Object Property Access (Parser) 14.5±0.04µs 14.1±0.04µs -2.76%
Fibonacci (Compiler) 3.6±0.01µs 3.5±0.01µs -2.78%
Fibonacci (Execution) 1207.1±3.13µs 1205.6±3.60µs -0.12%
Fibonacci (Parser) 23.3±0.07µs 23.0±0.02µs -1.29%
For loop (Compiler) 3.2±0.01µs 3.2±0.01µs 0.00%
For loop (Execution) 18.1±0.33µs 18.0±0.07µs -0.55%
For loop (Parser) 20.1±0.03µs 19.9±0.05µs -1.00%
Mini js (Compiler) 5.2±0.01µs 5.1±0.05µs -1.92%
Mini js (Execution) 861.5±3.93µs 841.8±3.72µs -2.29%
Mini js (Parser) 35.8±0.08µs 35.9±0.06µs +0.28%
Number Object Access (Compiler) 1285.6±3.33ns 1276.3±3.19ns -0.72%
Number Object Access (Execution) 4.3±0.01µs 4.2±0.02µs -2.33%
Number Object Access (Parser) 15.5±0.02µs 15.5±0.02µs 0.00%
Object Creation (Compiler) 2.1±0.00µs 2.1±0.01µs 0.00%
Object Creation (Execution) 4.9±0.02µs 4.8±0.01µs -2.04%
Object Creation (Parser) 12.8±0.03µs 12.5±0.03µs -2.34%
RegExp (Compiler) 2.3±0.01µs 2.3±0.01µs 0.00%
RegExp (Execution) 14.5±0.04µs 13.9±0.06µs -4.14%
RegExp (Parser) 14.0±0.03µs 13.7±0.03µs -2.14%
RegExp Creation (Compiler) 2.1±0.01µs 2.1±0.00µs 0.00%
RegExp Creation (Execution) 10.3±0.14µs 9.9±0.02µs -3.88%
RegExp Creation (Parser) 11.7±0.02µs 11.5±0.02µs -1.71%
RegExp Literal (Compiler) 2.3±0.01µs 2.3±0.01µs 0.00%
RegExp Literal (Execution) 14.4±0.10µs 13.9±0.04µs -3.47%
RegExp Literal (Parser) 15.7±0.02µs 15.2±0.06µs -3.18%
RegExp Literal Creation (Compiler) 2.1±0.00µs 2.1±0.00µs 0.00%
RegExp Literal Creation (Execution) 10.3±0.03µs 10.0±0.03µs -2.91%
RegExp Literal Creation (Parser) 13.4±0.03µs 12.9±0.03µs -3.73%
Static Object Property Access (Compiler) 2.1±0.00µs 2.1±0.00µs 0.00%
Static Object Property Access (Execution) 5.1±0.01µs 4.9±0.01µs -3.92%
Static Object Property Access (Parser) 13.7±0.03µs 13.5±0.03µs -1.46%
String Object Access (Compiler) 1736.5±5.63ns 1760.6±9.40ns +1.39%
String Object Access (Execution) 7.5±0.10µs 7.3±0.02µs -2.67%
String Object Access (Parser) 19.8±0.04µs 19.6±0.04µs -1.01%
String comparison (Compiler) 3.0±0.01µs 3.0±0.01µs 0.00%
String comparison (Execution) 4.5±0.07µs 4.4±0.01µs -2.22%
String comparison (Parser) 15.9±0.04µs 15.7±0.05µs -1.26%
String concatenation (Compiler) 2.4±0.01µs 2.4±0.01µs 0.00%
String concatenation (Execution) 4.3±0.21µs 4.1±0.04µs -4.65%
String concatenation (Parser) 10.8±0.03µs 10.6±0.02µs -1.85%
String copy (Compiler) 1937.8±4.37ns 1975.5±6.26ns +1.95%
String copy (Execution) 4.0±0.03µs 3.9±0.01µs -2.50%
String copy (Parser) 8.0±0.01µs 7.8±0.02µs -2.50%
Symbols (Compiler) 1427.3±3.77ns 1453.5±5.01ns +1.84%
Symbols (Execution) 4.2±0.01µs 4.2±0.01µs 0.00%
Symbols (Parser) 6.2±0.02µs 6.0±0.01µs -3.23%

@github-actions
Copy link

Benchmark for 2cf9c0d

Click to view benchmark
Test Base PR %
Arithmetic operations (Compiler) 556.7±2.31ns 563.4±0.56ns +1.20%
Arithmetic operations (Execution) 449.3±0.25ns 441.0±0.15ns -1.85%
Arithmetic operations (Parser) 7.2±0.01µs 7.1±0.01µs -1.39%
Array access (Compiler) 1654.2±3.09ns 1622.1±3.50ns -1.94%
Array access (Execution) 7.1±0.01µs 6.8±0.02µs -4.23%
Array access (Parser) 14.7±0.03µs 14.8±0.04µs +0.68%
Array creation (Compiler) 2.4±0.01µs 2.4±0.00µs 0.00%
Array creation (Execution) 1024.4±3.77µs 954.0±1.95µs -6.87%
Array creation (Parser) 17.5±0.02µs 17.5±0.03µs 0.00%
Array pop (Compiler) 4.4±0.01µs 4.2±0.01µs -4.55%
Array pop (Execution) 604.7±3.87µs 569.8±6.79µs -5.77%
Array pop (Parser) 155.2±0.10µs 153.9±0.14µs -0.84%
Boolean Object Access (Compiler) 1200.4±3.32ns 1200.9±2.88ns +0.04%
Boolean Object Access (Execution) 4.7±0.01µs 4.7±0.01µs 0.00%
Boolean Object Access (Parser) 18.5±0.06µs 18.1±0.02µs -2.16%
Clean js (Compiler) 4.9±0.01µs 4.8±0.01µs -2.04%
Clean js (Execution) 781.1±2.75µs 756.6±5.81µs -3.14%
Clean js (Parser) 36.9±0.09µs 36.3±0.04µs -1.63%
Create Realm 426.1±1.20µs 498.3±1.13µs +16.94%
Dynamic Object Property Access (Compiler) 1977.0±3.51ns 1965.3±2.73ns -0.59%
Dynamic Object Property Access (Execution) 4.5±0.01µs 4.3±0.01µs -4.44%
Dynamic Object Property Access (Parser) 13.1±0.02µs 13.0±0.01µs -0.76%
Fibonacci (Compiler) 3.0±0.01µs 3.0±0.01µs 0.00%
Fibonacci (Execution) 1048.9±1.82µs 1015.3±4.52µs -3.20%
Fibonacci (Parser) 20.5±0.08µs 20.5±0.02µs 0.00%
For loop (Compiler) 2.7±0.01µs 2.7±0.00µs 0.00%
For loop (Execution) 15.2±0.05µs 15.2±0.04µs 0.00%
For loop (Parser) 18.0±0.07µs 17.9±0.02µs -0.56%
Mini js (Compiler) 4.4±0.01µs 4.3±0.01µs -2.27%
Mini js (Execution) 735.2±2.31µs 729.6±13.61µs -0.76%
Mini js (Parser) 32.5±0.05µs 32.0±0.04µs -1.54%
Number Object Access (Compiler) 1128.3±3.08ns 1127.3±1.47ns -0.09%
Number Object Access (Execution) 3.6±0.03µs 3.5±0.01µs -2.78%
Number Object Access (Parser) 13.9±0.06µs 13.9±0.02µs 0.00%
Object Creation (Compiler) 1783.7±2.11ns 1759.4±12.10ns -1.36%
Object Creation (Execution) 4.1±0.01µs 4.1±0.01µs 0.00%
Object Creation (Parser) 11.5±0.01µs 11.5±0.02µs 0.00%
RegExp (Compiler) 1966.2±9.93ns 1937.3±4.07ns -1.47%
RegExp (Execution) 12.0±0.03µs 12.1±0.03µs +0.83%
RegExp (Parser) 12.5±0.02µs 12.6±0.04µs +0.80%
RegExp Creation (Compiler) 1757.4±5.50ns 1744.0±2.38ns -0.76%
RegExp Creation (Execution) 8.4±0.04µs 8.5±0.01µs +1.19%
RegExp Creation (Parser) 10.5±0.02µs 10.5±0.02µs 0.00%
RegExp Literal (Compiler) 1970.7±7.33ns 1944.0±3.99ns -1.35%
RegExp Literal (Execution) 12.0±0.02µs 12.0±0.03µs 0.00%
RegExp Literal (Parser) 13.6±0.04µs 13.7±0.03µs +0.74%
RegExp Literal Creation (Compiler) 1768.3±2.61ns 1755.6±2.13ns -0.72%
RegExp Literal Creation (Execution) 8.3±0.01µs 8.5±0.04µs +2.41%
RegExp Literal Creation (Parser) 11.5±0.03µs 11.7±0.05µs +1.74%
Static Object Property Access (Compiler) 1798.0±1.74ns 1791.4±2.46ns -0.37%
Static Object Property Access (Execution) 4.3±0.01µs 4.2±0.01µs -2.33%
Static Object Property Access (Parser) 12.5±0.03µs 12.3±0.03µs -1.60%
String Object Access (Compiler) 1524.1±6.43ns 1509.8±2.27ns -0.94%
String Object Access (Execution) 6.3±0.01µs 6.1±0.01µs -3.17%
String Object Access (Parser) 17.8±0.02µs 17.4±0.10µs -2.25%
String comparison (Compiler) 2.5±0.00µs 2.4±0.01µs -4.00%
String comparison (Execution) 3.8±0.01µs 3.7±0.01µs -2.63%
String comparison (Parser) 14.1±0.03µs 13.9±0.01µs -1.42%
String concatenation (Compiler) 1997.9±9.76ns 1977.2±8.79ns -1.04%
String concatenation (Execution) 3.6±0.01µs 3.5±0.01µs -2.78%
String concatenation (Parser) 9.6±0.03µs 9.5±0.01µs -1.04%
String copy (Compiler) 1650.6±2.49ns 1630.1±7.87ns -1.24%
String copy (Execution) 3.4±0.01µs 3.3±0.01µs -2.94%
String copy (Parser) 7.2±0.02µs 7.2±0.02µs 0.00%
Symbols (Compiler) 1230.1±3.97ns 1202.0±1.43ns -2.28%
Symbols (Execution) 3.6±0.01µs 3.5±0.01µs -2.78%
Symbols (Parser) 5.6±0.02µs 5.6±0.02µs 0.00%

Copy link
Member

@Razican Razican left a comment

Choose a reason for hiding this comment

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

This looks very good to me :) thanks!

@jedel1043
Copy link
Member Author

bors r+

bors bot pushed a commit that referenced this pull request Apr 12, 2023
This Pull Request lifts the `InternalObjectMethods` vtable from `Object`, which should technically improve performance, since we now won't need to call `borrow` to use any of the internal methods, but let's see what the benchmarks show.

It changes the following:

- Adds a new `VTableObject` struct, containing the old `GcRefCell<Object>` and the lifted `InternalObjectMethods`.
- Changes the definition of `JsObject` to `Gc<VTableObject>`. Note that this means the `InternalObjectMethods` are accessible through the `Gc` pointer.
- Reestructures intrinsic initialization and initialization APIs to accommodate this change.
@bors
Copy link

bors bot commented Apr 12, 2023

Pull request successfully merged into main.

Build succeeded:

@bors bors bot changed the title Lift InternalObjectMethods from Object [Merged by Bors] - Lift InternalObjectMethods from Object Apr 12, 2023
@bors bors bot closed this Apr 12, 2023
@bors bors bot deleted the lift-vtable branch April 12, 2023 14:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Internal Category for changelog run-benchmark Label used to run banchmarks on PRs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants