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

Implement Inline Caching #2767

Merged
merged 1 commit into from
Dec 4, 2023
Merged

Implement Inline Caching #2767

merged 1 commit into from
Dec 4, 2023

Conversation

HalidOdat
Copy link
Member

@HalidOdat HalidOdat commented Mar 30, 2023

Depends on #2723

This PR icurrently just a POC implements inline caching. This merges into #2723 so the changes can be easily seen, will switch to main, once Hidden classes gets merged.

Because the Proxy internal methods are not implement this will introduce a lot of panics ( will fix ), Was curious about the benchmarks since, we don't have proxys in the benchmarks they shouldn't fail. The inline caching is now internal method aware so it knows what can be cached.

It changes the following:

  • Fix incorrect handling of Proxy internal methods
  • Make inline caching internal method aware
  • Add inline caching to GetPropertyByName
  • Add inline caching to SetPropertyByName
  • Add inline caching to GetName
  • Add inline caching to SetName

@HalidOdat HalidOdat added performance Performance related changes and issues execution Issues or PRs related to code execution run-benchmark Label used to run banchmarks on PRs labels Mar 30, 2023
@HalidOdat HalidOdat force-pushed the optimization/inline-caching branch from 40c7d4a to 8f6ec97 Compare March 30, 2023 18:53
@HalidOdat HalidOdat marked this pull request as ready for review March 30, 2023 18:56
@HalidOdat HalidOdat marked this pull request as draft March 30, 2023 18:56
@HalidOdat HalidOdat force-pushed the optimization/inline-caching branch from 8f6ec97 to e561aaf Compare March 30, 2023 20:20
@HalidOdat HalidOdat changed the base branch from optimization/object-shapes to main March 30, 2023 20:24
@HalidOdat HalidOdat marked this pull request as ready for review March 30, 2023 20:24
@HalidOdat HalidOdat force-pushed the optimization/inline-caching branch from e561aaf to eadc11e Compare March 30, 2023 20:34
@HalidOdat HalidOdat marked this pull request as draft March 30, 2023 20:40
@codecov
Copy link

codecov bot commented Mar 30, 2023

Codecov Report

Attention: 101 lines in your changes are missing coverage. Please review.

Comparison is base (6506f65) 45.10% compared to head (2ff6c51) 45.27%.

Files Patch % Lines
boa_engine/src/vm/opcode/set/property.rs 55.10% 22 Missing ⚠️
boa_engine/src/vm/code_block.rs 47.61% 11 Missing ⚠️
boa_engine/src/builtins/object/mod.rs 52.38% 10 Missing ⚠️
boa_engine/src/object/operations.rs 84.78% 7 Missing ⚠️
boa_engine/src/vm/opcode/define/class/getter.rs 0.00% 7 Missing ⚠️
boa_engine/src/vm/opcode/define/class/setter.rs 0.00% 7 Missing ⚠️
boa_engine/src/object/internal_methods/proxy.rs 16.66% 5 Missing ⚠️
boa_engine/src/bytecompiler/mod.rs 83.33% 4 Missing ⚠️
boa_engine/src/object/shape/slot.rs 69.23% 4 Missing ⚠️
boa_engine/src/vm/opcode/define/class/method.rs 0.00% 3 Missing ⚠️
... and 14 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2767      +/-   ##
==========================================
+ Coverage   45.10%   45.27%   +0.17%     
==========================================
  Files         496      496              
  Lines       50590    50810     +220     
==========================================
+ Hits        22817    23006     +189     
- Misses      27773    27804      +31     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@github-actions
Copy link

Benchmark for 621c245

Click to view benchmark
Test Base PR %
Arithmetic operations (Compiler) 671.1±11.60ns 783.8±15.51ns +16.79%
Arithmetic operations (Execution) 542.1±11.67ns 535.9±7.17ns -1.14%
Arithmetic operations (Parser) 7.9±0.06µs 7.6±0.16µs -3.80%
Array access (Compiler) 1949.5±21.96ns 2.2±0.04µs +12.85%
Array access (Execution) 8.2±0.26µs 6.6±0.15µs -19.51%
Array access (Parser) 15.8±0.24µs 15.6±0.43µs -1.27%
Array creation (Compiler) 2.9±0.02µs 3.1±0.07µs +6.90%
Array creation (Execution) 1218.5±25.30µs 1216.7±25.19µs -0.15%
Array creation (Parser) 18.9±0.28µs 18.7±0.48µs -1.06%
Array pop (Compiler) 5.1±0.07µs 5.4±0.11µs +5.88%
Array pop (Execution) 709.2±9.29µs 772.1±12.13µs +8.87%
Array pop (Parser) 174.5±0.78µs 169.4±2.16µs -2.92%
Boolean Object Access (Compiler) 1343.3±12.43ns 1734.6±33.45ns +29.13%
Boolean Object Access (Execution) 4.7±0.09µs 5.8±0.06µs +23.40%
Boolean Object Access (Parser) 20.2±0.24µs 20.3±0.31µs +0.50%
Clean js (Compiler) 5.6±0.13µs 6.4±0.16µs +14.29%
Clean js (Execution) 676.9±15.11µs 827.7±19.61µs +22.28%
Clean js (Parser) 39.9±0.60µs 40.1±0.74µs +0.50%
Create Realm 490.8±13.17µs 722.4±14.36µs +47.19%
Dynamic Object Property Access (Compiler) 2.3±0.02µs 2.6±0.06µs +13.04%
Dynamic Object Property Access (Execution) 5.2±0.07µs 3.4±0.09µs -34.62%
Dynamic Object Property Access (Parser) 13.9±0.50µs 14.0±0.23µs +0.72%
Fibonacci (Compiler) 3.5±0.03µs 3.9±0.08µs +11.43%
Fibonacci (Execution) 1136.0±17.54µs 718.0±13.92µs -36.80%
Fibonacci (Parser) 22.3±0.45µs 22.6±0.60µs +1.35%
For loop (Compiler) 3.1±0.04µs 3.5±0.08µs +12.90%
For loop (Execution) 18.3±0.33µs 17.7±0.25µs -3.28%
For loop (Parser) 19.5±0.35µs 19.8±0.68µs +1.54%
Mini js (Compiler) 5.1±0.07µs 5.8±0.16µs +13.73%
Mini js (Execution) 635.0±7.78µs 777.2±12.76µs +22.39%
Mini js (Parser) 35.2±0.25µs 34.6±0.75µs -1.70%
Number Object Access (Compiler) 1276.7±23.31ns 1576.2±23.27ns +23.46%
Number Object Access (Execution) 3.6±0.09µs 4.4±0.09µs +22.22%
Number Object Access (Parser) 15.2±0.37µs 15.6±0.19µs +2.63%
Object Creation (Compiler) 2.1±0.02µs 2.4±0.05µs +14.29%
Object Creation (Execution) 4.9±0.12µs 3.0±0.05µs -38.78%
Object Creation (Parser) 12.3±0.29µs 12.4±0.24µs +0.81%
RegExp (Compiler) 2.3±0.06µs 2.7±0.06µs +17.39%
RegExp (Execution) 13.4±0.12µs 12.1±0.23µs -9.70%
RegExp (Parser) 13.8±0.21µs 13.8±0.26µs 0.00%
RegExp Creation (Compiler) 2.0±0.01µs 2.3±0.05µs +15.00%
RegExp Creation (Execution) 9.3±0.20µs 8.0±0.22µs -13.98%
RegExp Creation (Parser) 11.4±0.24µs 11.4±0.27µs 0.00%
RegExp Literal (Compiler) 2.3±0.04µs 2.7±0.05µs +17.39%
RegExp Literal (Execution) 13.2±0.27µs 12.0±0.30µs -9.09%
RegExp Literal (Parser) 14.8±0.37µs 15.3±0.25µs +3.38%
RegExp Literal Creation (Compiler) 2.0±0.02µs 2.3±0.05µs +15.00%
RegExp Literal Creation (Execution) 9.2±0.28µs 8.0±0.19µs -13.04%
RegExp Literal Creation (Parser) 12.7±0.22µs 12.9±0.30µs +1.57%
Static Object Property Access (Compiler) 2.1±0.02µs 2.5±0.05µs +19.05%
Static Object Property Access (Execution) 5.0±0.15µs 3.2±0.07µs -36.00%
Static Object Property Access (Parser) 13.3±0.26µs 13.3±0.30µs 0.00%
String Object Access (Compiler) 1706.0±32.10ns 2.1±0.05µs +23.09%
String Object Access (Execution) 6.4±0.12µs 7.7±0.18µs +20.31%
String Object Access (Parser) 19.3±0.24µs 19.7±0.39µs +2.07%
String comparison (Compiler) 2.9±0.04µs 3.2±0.08µs +10.34%
String comparison (Execution) 4.4±0.09µs 2.5±0.04µs -43.18%
String comparison (Parser) 15.5±0.15µs 15.6±0.50µs +0.65%
String concatenation (Compiler) 2.3±0.03µs 2.6±0.08µs +13.04%
String concatenation (Execution) 4.1±0.07µs 2.2±0.04µs -46.34%
String concatenation (Parser) 10.5±0.11µs 10.6±0.20µs +0.95%
String copy (Compiler) 1921.2±42.95ns 2.3±0.04µs +19.72%
String copy (Execution) 3.9±0.07µs 2.0±0.03µs -48.72%
String copy (Parser) 7.7±0.11µs 7.7±0.19µs 0.00%
Symbols (Compiler) 1451.1±19.95ns 1695.4±33.09ns +16.84%
Symbols (Execution) 3.9±0.07µs 2.2±0.02µs -43.59%
Symbols (Parser) 5.8±0.17µs 5.9±0.11µs +1.72%

@HalidOdat HalidOdat force-pushed the optimization/inline-caching branch from eadc11e to 4a403c4 Compare April 6, 2023 01:24
@github-actions
Copy link

github-actions bot commented Apr 6, 2023

Test262 conformance changes

Test result main count PR count difference
Total 95,609 95,609 0
Passed 76,526 76,526 0
Ignored 18,132 18,132 0
Failed 951 951 0
Panics 0 0 0
Conformance 80.04% 80.04% 0.00%

@github-actions
Copy link

github-actions bot commented Apr 6, 2023

Benchmark for cf2d077

Click to view benchmark
Test Base PR %
Arithmetic operations (Compiler) 572.7±1.14ns 621.1±326.29ns +8.45%
Arithmetic operations (Execution) 441.0±0.20ns 441.3±0.18ns +0.07%
Arithmetic operations (Parser) 7.0±0.02µs 7.1±0.05µs +1.43%
Array access (Compiler) 1622.9±1.89ns 1863.8±897.38ns +14.84%
Array access (Execution) 7.2±0.01µs 6.3±2.71µs -12.50%
Array access (Parser) 14.8±0.02µs 14.7±0.04µs -0.68%
Array creation (Compiler) 2.4±0.00µs 2.8±1.52µs +16.67%
Array creation (Execution) 1004.6±8.39µs 1178.2±312.48µs +17.28%
Array creation (Parser) 17.3±0.02µs 17.5±0.03µs +1.16%
Array pop (Compiler) 4.4±0.01µs 4.7±1.73µs +6.82%
Array pop (Execution) 586.3±1.29µs 706.3±145.23µs +20.47%
Array pop (Parser) 152.5±0.22µs 154.5±0.22µs +1.31%
Boolean Object Access (Compiler) 1192.6±0.66ns 1630.1±628.18ns +36.68%
Boolean Object Access (Execution) 3.9±0.02µs 5.3±2.15µs +35.90%
Boolean Object Access (Parser) 18.1±0.02µs 18.1±0.02µs 0.00%
Clean js (Compiler) 4.9±0.01µs 6.4±3.82µs +30.61%
Clean js (Execution) 590.3±2.74µs 760.8±163.42µs +28.88%
Clean js (Parser) 36.6±0.04µs 36.8±0.04µs +0.55%
Create Realm 417.7±4.29µs 477.6±666.14µs +14.34%
Dynamic Object Property Access (Compiler) 1892.1±8.04ns 2.3±1.47µs +21.56%
Dynamic Object Property Access (Execution) 4.5±0.01µs 3.6±5.35µs -20.00%
Dynamic Object Property Access (Parser) 13.1±0.02µs 13.2±0.02µs +0.76%
Fibonacci (Compiler) 3.0±0.01µs 3.3±1.54µs +10.00%
Fibonacci (Execution) 1001.7±1.34µs 721.5±346.13µs -27.97%
Fibonacci (Parser) 20.9±0.03µs 21.0±0.03µs +0.48%
For loop (Compiler) 2.6±0.00µs 3.3±1.48µs +26.92%
For loop (Execution) 15.7±0.03µs 17.1±11.46µs +8.92%
For loop (Parser) 17.9±0.02µs 17.8±0.04µs -0.56%
Mini js (Compiler) 4.3±0.01µs 5.5±2.85µs +27.91%
Mini js (Execution) 542.8±2.16µs 682.4±81.49µs +25.72%
Mini js (Parser) 32.4±0.14µs 32.2±0.06µs -0.62%
Number Object Access (Compiler) 1113.0±13.59ns 1614.1±2259.35ns +45.02%
Number Object Access (Execution) 3.1±0.01µs 3.9±1.24µs +25.81%
Number Object Access (Parser) 13.9±0.03µs 14.0±0.02µs +0.72%
Object Creation (Compiler) 1734.7±2.65ns 2.1±1.55µs +21.06%
Object Creation (Execution) 4.2±0.01µs 3.1±3.05µs -26.19%
Object Creation (Parser) 11.5±0.01µs 11.6±0.03µs +0.87%
RegExp (Compiler) 1923.6±5.79ns 2.3±1.17µs +19.57%
RegExp (Execution) 11.6±0.05µs 11.2±3.21µs -3.45%
RegExp (Parser) 12.6±0.03µs 12.7±0.04µs +0.79%
RegExp Creation (Compiler) 1701.5±3.89ns 1995.9±1053.49ns +17.30%
RegExp Creation (Execution) 8.3±0.02µs 7.7±3.07µs -7.23%
RegExp Creation (Parser) 10.6±0.04µs 10.6±0.02µs 0.00%
RegExp Literal (Compiler) 1920.7±3.44ns 2.3±1.14µs +19.75%
RegExp Literal (Execution) 11.6±0.04µs 11.6±3.71µs 0.00%
RegExp Literal (Parser) 13.6±0.07µs 14.0±0.03µs +2.94%
RegExp Literal Creation (Compiler) 1700.8±2.46ns 2.0±1.08µs +17.59%
RegExp Literal Creation (Execution) 8.2±0.02µs 7.5±2.56µs -8.54%
RegExp Literal Creation (Parser) 11.5±0.03µs 11.8±0.03µs +2.61%
Static Object Property Access (Compiler) 1748.4±1.50ns 2.1±1.14µs +20.11%
Static Object Property Access (Execution) 4.4±0.01µs 3.0±1.64µs -31.82%
Static Object Property Access (Parser) 12.4±0.01µs 12.3±0.07µs -0.81%
String Object Access (Compiler) 1509.8±2.20ns 2.1±1.00µs +39.09%
String Object Access (Execution) 5.4±0.01µs 7.3±2.84µs +35.19%
String Object Access (Parser) 17.4±0.02µs 17.4±0.06µs 0.00%
String comparison (Compiler) 2.5±0.00µs 2.9±1.43µs +16.00%
String comparison (Execution) 3.8±0.01µs 2.2±1.26µs -42.11%
String comparison (Parser) 14.1±0.03µs 14.0±0.01µs -0.71%
String concatenation (Compiler) 1944.0±2.80ns 2.3±1.37µs +18.31%
String concatenation (Execution) 3.6±0.01µs 2.3±1.60µs -36.11%
String concatenation (Parser) 9.7±0.04µs 9.5±0.01µs -2.06%
String copy (Compiler) 1597.9±3.47ns 1882.7±993.03ns +17.82%
String copy (Execution) 3.4±0.01µs 1880.4±1054.12ns -44.69%
String copy (Parser) 7.3±0.02µs 7.2±0.01µs -1.37%
Symbols (Compiler) 1221.5±2.05ns 1497.0±1171.11ns +22.55%
Symbols (Execution) 3.4±0.01µs 1964.8±1227.18ns -42.21%
Symbols (Parser) 5.6±0.01µs 5.6±0.06µs 0.00%

@HalidOdat HalidOdat force-pushed the optimization/inline-caching branch from 4a403c4 to 604489f Compare April 8, 2023 19:07
@github-actions
Copy link

github-actions bot commented Apr 8, 2023

Benchmark for e8a1b4a

Click to view benchmark
Test Base PR %
Arithmetic operations (Compiler) 558.5±0.67ns 657.5±703.57ns +17.73%
Arithmetic operations (Execution) 447.6±0.15ns 444.4±0.29ns -0.71%
Arithmetic operations (Parser) 7.1±0.01µs 7.1±0.01µs 0.00%
Array access (Compiler) 1610.0±2.89ns 1854.6±920.30ns +15.19%
Array access (Execution) 7.1±0.02µs 6.1±2.37µs -14.08%
Array access (Parser) 14.5±0.02µs 14.8±0.01µs +2.07%
Array creation (Compiler) 2.4±0.00µs 2.8±1.83µs +16.67%
Array creation (Execution) 1042.6±6.93µs 1164.8±299.56µs +11.72%
Array creation (Parser) 17.5±0.06µs 17.5±0.02µs 0.00%
Array pop (Compiler) 4.1±0.01µs 4.8±2.15µs +17.07%
Array pop (Execution) 601.7±6.25µs 625.0±138.42µs +3.87%
Array pop (Parser) 154.1±0.10µs 154.9±0.16µs +0.52%
Boolean Object Access (Compiler) 1186.1±1.34ns 1906.3±2145.98ns +60.72%
Boolean Object Access (Execution) 3.8±0.01µs 4.1±1.51µs +7.89%
Boolean Object Access (Parser) 18.0±0.02µs 18.2±0.02µs +1.11%
Clean js (Compiler) 4.8±0.01µs 6.2±2.89µs +29.17%
Clean js (Execution) 588.5±2.69µs 694.3±145.85µs +17.98%
Clean js (Parser) 36.7±0.04µs 36.9±0.42µs +0.54%
Create Realm 424.3±5.48µs 482.4±718.07µs +13.69%
Dynamic Object Property Access (Compiler) 1878.4±2.86ns 2.3±1.24µs +22.44%
Dynamic Object Property Access (Execution) 4.4±0.04µs 3.1±1.65µs -29.55%
Dynamic Object Property Access (Parser) 13.0±0.07µs 13.3±0.02µs +2.31%
Fibonacci (Compiler) 2.9±0.00µs 3.3±1.53µs +13.79%
Fibonacci (Execution) 979.0±2.59µs 733.0±434.11µs -25.13%
Fibonacci (Parser) 20.6±0.03µs 20.8±0.02µs +0.97%
For loop (Compiler) 2.6±0.01µs 3.1±1.57µs +19.23%
For loop (Execution) 15.6±0.03µs 17.2±15.12µs +10.26%
For loop (Parser) 17.9±0.04µs 18.0±0.03µs +0.56%
Mini js (Compiler) 4.3±0.01µs 5.2±2.84µs +20.93%
Mini js (Execution) 540.8±1.55µs 623.1±65.67µs +15.22%
Mini js (Parser) 32.1±0.04µs 32.0±0.05µs -0.31%
Number Object Access (Compiler) 1108.4±2.12ns 1591.6±858.55ns +43.59%
Number Object Access (Execution) 3.0±0.01µs 3.3±1.21µs +10.00%
Number Object Access (Parser) 13.7±0.01µs 13.8±0.03µs +0.73%
Object Creation (Compiler) 1695.1±2.31ns 2.1±1.35µs +23.89%
Object Creation (Execution) 4.1±0.01µs 2.8±1.89µs -31.71%
Object Creation (Parser) 11.5±0.01µs 11.6±0.03µs +0.87%
RegExp (Compiler) 1897.3±2.91ns 2.3±1.16µs +21.22%
RegExp (Execution) 11.8±0.05µs 11.1±3.47µs -5.93%
RegExp (Parser) 12.5±0.02µs 12.7±0.02µs +1.60%
RegExp Creation (Compiler) 1681.6±3.13ns 2.0±1.12µs +18.93%
RegExp Creation (Execution) 8.3±0.02µs 7.9±3.22µs -4.82%
RegExp Creation (Parser) 10.5±0.02µs 10.7±0.02µs +1.90%
RegExp Literal (Compiler) 1904.2±2.86ns 2.5±2.45µs +31.29%
RegExp Literal (Execution) 11.8±0.05µs 11.2±3.69µs -5.08%
RegExp Literal (Parser) 13.7±0.03µs 13.9±0.02µs +1.46%
RegExp Literal Creation (Compiler) 1679.4±2.77ns 2.1±1.43µs +25.04%
RegExp Literal Creation (Execution) 8.3±0.02µs 7.7±2.80µs -7.23%
RegExp Literal Creation (Parser) 11.7±0.10µs 11.8±0.02µs +0.85%
Static Object Property Access (Compiler) 1717.1±2.65ns 2.2±1.38µs +28.12%
Static Object Property Access (Execution) 4.3±0.01µs 2.9±1.69µs -32.56%
Static Object Property Access (Parser) 12.3±0.02µs 12.5±0.02µs +1.63%
String Object Access (Compiler) 1483.3±1.23ns 2.1±0.82µs +41.58%
String Object Access (Execution) 5.4±0.01µs 6.0±2.11µs +11.11%
String Object Access (Parser) 17.4±0.02µs 17.4±0.02µs 0.00%
String comparison (Compiler) 2.4±0.00µs 3.0±1.90µs +25.00%
String comparison (Execution) 3.8±0.01µs 2.4±1.43µs -36.84%
String comparison (Parser) 14.0±0.03µs 14.1±0.01µs +0.71%
String concatenation (Compiler) 1932.5±3.51ns 2.3±1.34µs +19.02%
String concatenation (Execution) 3.5±0.02µs 2.3±1.57µs -34.29%
String concatenation (Parser) 9.6±0.01µs 9.7±0.02µs +1.04%
String copy (Compiler) 1597.4±1.73ns 1893.7±1047.72ns +18.55%
String copy (Execution) 3.3±0.01µs 1785.2±1100.40ns -45.90%
String copy (Parser) 7.3±0.01µs 7.3±0.01µs 0.00%
Symbols (Compiler) 1191.0±3.69ns 1550.1±1261.57ns +30.15%
Symbols (Execution) 3.3±0.01µs 2.1±1.49µs -36.36%
Symbols (Parser) 5.7±0.05µs 5.7±0.02µs 0.00%

@HalidOdat HalidOdat force-pushed the optimization/inline-caching branch from 604489f to 4ebb6a2 Compare April 9, 2023 01:23
@github-actions
Copy link

github-actions bot commented Apr 9, 2023

Benchmark for 7ef3514

Click to view benchmark
Test Base PR %
Arithmetic operations (Compiler) 559.6±0.65ns 624.6±292.50ns +11.62%
Arithmetic operations (Execution) 441.3±0.25ns 441.1±0.18ns -0.05%
Arithmetic operations (Parser) 7.1±0.01µs 7.1±0.01µs 0.00%
Array access (Compiler) 1603.0±1.87ns 2.2±3.25µs +37.24%
Array access (Execution) 7.1±0.01µs 6.3±2.99µs -11.27%
Array access (Parser) 14.6±0.03µs 14.5±0.02µs -0.68%
Array creation (Compiler) 2.4±0.00µs 2.8±1.39µs +16.67%
Array creation (Execution) 1036.3±2.33µs 1158.9±435.30µs +11.83%
Array creation (Parser) 17.4±0.03µs 17.4±0.02µs 0.00%
Array pop (Compiler) 4.1±0.01µs 4.6±1.78µs +12.20%
Array pop (Execution) 602.2±7.64µs 616.7±110.93µs +2.41%
Array pop (Parser) 154.2±0.15µs 155.0±0.27µs +0.52%
Boolean Object Access (Compiler) 1180.2±2.01ns 1659.2±626.87ns +40.59%
Boolean Object Access (Execution) 3.9±0.02µs 4.1±1.89µs +5.13%
Boolean Object Access (Parser) 18.0±0.01µs 17.8±0.03µs -1.11%
Clean js (Compiler) 4.8±0.01µs 6.2±3.24µs +29.17%
Clean js (Execution) 593.1±2.44µs 686.5±146.84µs +15.75%
Clean js (Parser) 36.8±0.03µs 36.7±0.04µs -0.27%
Create Realm 426.0±2.16µs 501.9±774.94µs +17.82%
Dynamic Object Property Access (Compiler) 1885.2±3.46ns 2.4±2.14µs +27.31%
Dynamic Object Property Access (Execution) 4.4±0.01µs 3.3±2.02µs -25.00%
Dynamic Object Property Access (Parser) 13.1±0.04µs 13.0±0.02µs -0.76%
Fibonacci (Compiler) 3.0±0.01µs 3.4±1.80µs +13.33%
Fibonacci (Execution) 984.6±2.40µs 756.8±467.26µs -23.14%
Fibonacci (Parser) 20.6±0.03µs 20.8±0.04µs +0.97%
For loop (Compiler) 2.6±0.01µs 3.4±2.68µs +30.77%
For loop (Execution) 15.5±0.02µs 15.4±8.48µs -0.65%
For loop (Parser) 17.8±0.04µs 17.8±0.03µs 0.00%
Mini js (Compiler) 4.3±0.02µs 5.2±2.94µs +20.93%
Mini js (Execution) 544.6±2.30µs 623.2±66.54µs +14.43%
Mini js (Parser) 32.1±0.05µs 32.2±0.03µs +0.31%
Number Object Access (Compiler) 1115.1±2.44ns 1437.6±553.18ns +28.92%
Number Object Access (Execution) 3.0±0.01µs 3.4±2.07µs +13.33%
Number Object Access (Parser) 13.7±0.02µs 13.6±0.02µs -0.73%
Object Creation (Compiler) 1719.8±3.48ns 2.1±1.20µs +22.11%
Object Creation (Execution) 4.1±0.01µs 2.9±1.94µs -29.27%
Object Creation (Parser) 11.5±0.01µs 11.4±0.02µs -0.87%
RegExp (Compiler) 1934.0±8.89ns 2.4±1.85µs +24.10%
RegExp (Execution) 11.8±0.04µs 10.9±3.98µs -7.63%
RegExp (Parser) 12.6±0.01µs 12.5±0.02µs -0.79%
RegExp Creation (Compiler) 1702.1±3.04ns 2.1±1.11µs +23.38%
RegExp Creation (Execution) 8.3±0.02µs 7.8±5.34µs -6.02%
RegExp Creation (Parser) 10.6±0.02µs 10.5±0.02µs -0.94%
RegExp Literal (Compiler) 1937.6±3.15ns 2.4±1.62µs +23.86%
RegExp Literal (Execution) 11.8±0.04µs 11.3±6.64µs -4.24%
RegExp Literal (Parser) 13.7±0.01µs 13.7±0.04µs 0.00%
RegExp Literal Creation (Compiler) 1704.2±4.28ns 2.2±1.68µs +29.09%
RegExp Literal Creation (Execution) 8.3±0.03µs 7.3±2.73µs -12.05%
RegExp Literal Creation (Parser) 11.8±0.05µs 11.5±0.02µs -2.54%
Static Object Property Access (Compiler) 1725.3±2.63ns 2.2±1.44µs +27.51%
Static Object Property Access (Execution) 4.2±0.01µs 3.2±3.05µs -23.81%
Static Object Property Access (Parser) 12.3±0.02µs 12.3±0.02µs 0.00%
String Object Access (Compiler) 1491.2±1.31ns 2.0±0.85µs +34.12%
String Object Access (Execution) 5.5±0.01µs 6.2±5.66µs +12.73%
String Object Access (Parser) 17.4±0.02µs 17.2±0.03µs -1.15%
String comparison (Compiler) 2.4±0.01µs 3.0±1.50µs +25.00%
String comparison (Execution) 3.7±0.01µs 2.2±1.33µs -40.54%
String comparison (Parser) 14.1±0.01µs 13.9±0.02µs -1.42%
String concatenation (Compiler) 1933.8±4.09ns 2.4±1.59µs +24.11%
String concatenation (Execution) 3.5±0.01µs 2.1±1.27µs -40.00%
String concatenation (Parser) 9.6±0.01µs 9.6±0.01µs 0.00%
String copy (Compiler) 1587.7±4.82ns 2.0±1.47µs +25.97%
String copy (Execution) 3.3±0.01µs 1834.3±1251.01ns -44.42%
String copy (Parser) 7.3±0.01µs 7.1±0.02µs -2.74%
Symbols (Compiler) 1200.6±3.86ns 1546.3±1270.83ns +28.79%
Symbols (Execution) 3.3±0.01µs 1909.3±1169.05ns -42.14%
Symbols (Parser) 5.6±0.01µs 5.6±0.01µs 0.00%

@HalidOdat
Copy link
Member Author

HalidOdat commented Apr 9, 2023

There is still a lot of work to be done (currently only the GetPropertyByName has inline caching, because I'm still developing the arch. desing), but I was curious after implementing inline caching on prototype properties, so I ran a subset of the QuickJS benchmarks:

Main

Richards: 19.5
DeltaBlue: 20.1
RayTrace: 75.0
----
Score (version 7): 30.8
undefined

With Inline caching

Richards: 25.3
DeltaBlue: 30.5
RayTrace: 101
----
Score (version 7): 42.7
undefined

This is where #1605 really pays off, There are clear performance improvements.

@jedel1043 I was curious in the benchmarks in (#2790 (comment)) did you edit the file, because when I ran combined.js the main branch It froze on one of the benchmarks.

EDIT: full benchmarks:

Main

PROGRESS Richards
RESULT Richards 18.2
PROGRESS DeltaBlue
RESULT DeltaBlue 17.8
PROGRESS Encrypt
PROGRESS Decrypt
RESULT Crypto 31.8
PROGRESS RayTrace
RESULT RayTrace 68.0
PROGRESS Earley
PROGRESS Boyer
RESULT EarleyBoyer 69.2
ERROR RegExp TypeError: not a constructor
undefined
PROGRESS RegExp
PROGRESS Splay
RESULT Splay 95.1
PROGRESS NavierStokes
RESULT NavierStokes 6.14
SCORE 31.1
Uncaught Error: Benchmark had 1 errors

PR

PROGRESS Richards
RESULT Richards 24.3
PROGRESS DeltaBlue
RESULT DeltaBlue 27.3
PROGRESS Encrypt
PROGRESS Decrypt
RESULT Crypto 33.0
PROGRESS RayTrace
RESULT RayTrace 94.3
PROGRESS Earley
PROGRESS Boyer
RESULT EarleyBoyer 84.8
ERROR RegExp TypeError: not a constructor
undefined
PROGRESS RegExp
ERROR Splay Error: Key not found: 0.9521374255418777
undefined
PROGRESS Splay
PROGRESS NavierStokes
RESULT NavierStokes 6.13
SCORE 32.0
Uncaught Error: Benchmark had 2 errors

Hmmm. there seems to be a bug, that is causing Splay benchmark to fail, probably the same bug that is causing some test262 tests to fail, will look into it :)

@jedel1043
Copy link
Member

@jedel1043 I was curious in the benchmarks in (#2790 (comment)) did you edit the file, because when I ran combined.js the main branch It froze on one of the benchmarks.

In my case it seemed like it froze, but it was just the long execution time. The only benchmark that threw errors was RegExp I think.

@github-actions
Copy link

github-actions bot commented Apr 9, 2023

Benchmark for 703d5fe

Click to view benchmark
Test Base PR %
Arithmetic operations (Compiler) 577.0±1.52ns 631.9±302.94ns +9.51%
Arithmetic operations (Execution) 459.7±2.44ns 441.7±0.30ns -3.92%
Arithmetic operations (Parser) 7.1±0.01µs 7.1±0.01µs 0.00%
Array access (Compiler) 1647.2±3.80ns 1993.8±1248.30ns +21.04%
Array access (Execution) 7.1±0.03µs 6.2±2.97µs -12.68%
Array access (Parser) 14.6±0.03µs 14.5±0.03µs -0.68%
Array creation (Compiler) 2.4±0.01µs 3.1±2.91µs +29.17%
Array creation (Execution) 1027.9±1.96µs 1155.0±354.60µs +12.37%
Array creation (Parser) 17.4±0.02µs 17.4±0.03µs 0.00%
Array pop (Compiler) 4.2±0.01µs 4.8±1.93µs +14.29%
Array pop (Execution) 596.1±1.50µs 630.1±189.15µs +5.70%
Array pop (Parser) 154.4±0.16µs 154.4±0.27µs 0.00%
Boolean Object Access (Compiler) 1207.9±1.15ns 1756.9±771.30ns +45.45%
Boolean Object Access (Execution) 3.9±0.01µs 4.1±1.68µs +5.13%
Boolean Object Access (Parser) 18.1±0.03µs 18.0±0.04µs -0.55%
Clean js (Compiler) 4.9±0.01µs 6.4±4.76µs +30.61%
Clean js (Execution) 592.4±2.88µs 678.5±144.85µs +14.53%
Clean js (Parser) 36.9±0.05µs 36.6±0.05µs -0.81%
Create Realm 425.5±5.63µs 547.7±813.18µs +28.72%
Dynamic Object Property Access (Compiler) 1921.0±2.95ns 2.4±1.65µs +24.93%
Dynamic Object Property Access (Execution) 4.4±0.01µs 3.2±1.95µs -27.27%
Dynamic Object Property Access (Parser) 13.1±0.02µs 13.0±0.02µs -0.76%
Fibonacci (Compiler) 3.1±0.01µs 3.4±1.78µs +9.68%
Fibonacci (Execution) 974.6±1.33µs 750.7±497.28µs -22.97%
Fibonacci (Parser) 20.8±0.04µs 20.5±0.02µs -1.44%
For loop (Compiler) 2.7±0.01µs 3.4±2.86µs +25.93%
For loop (Execution) 15.6±0.04µs 18.6±31.85µs +19.23%
For loop (Parser) 17.9±0.03µs 17.8±0.02µs -0.56%
Mini js (Compiler) 4.4±0.01µs 5.6±3.33µs +27.27%
Mini js (Execution) 547.2±2.43µs 621.2±61.59µs +13.52%
Mini js (Parser) 32.3±0.03µs 32.0±0.04µs -0.93%
Number Object Access (Compiler) 1136.5±2.37ns 1655.3±1190.78ns +45.65%
Number Object Access (Execution) 3.0±0.01µs 3.2±1.31µs +6.67%
Number Object Access (Parser) 13.8±0.01µs 13.6±0.02µs -1.45%
Object Creation (Compiler) 1766.7±6.12ns 2.2±1.87µs +24.53%
Object Creation (Execution) 4.1±0.01µs 2.9±2.06µs -29.27%
Object Creation (Parser) 11.5±0.02µs 11.4±0.02µs -0.87%
RegExp (Compiler) 1963.6±3.52ns 2.4±1.41µs +22.22%
RegExp (Execution) 11.8±0.04µs 10.6±3.50µs -10.17%
RegExp (Parser) 12.5±0.16µs 12.5±0.02µs 0.00%
RegExp Creation (Compiler) 1735.7±3.13ns 2.0±1.12µs +15.23%
RegExp Creation (Execution) 8.3±0.03µs 7.9±5.97µs -4.82%
RegExp Creation (Parser) 10.5±0.01µs 10.6±0.02µs +0.95%
RegExp Literal (Compiler) 1963.1±3.51ns 2.4±1.29µs +22.26%
RegExp Literal (Execution) 11.8±0.05µs 11.3±5.31µs -4.24%
RegExp Literal (Parser) 13.8±0.02µs 13.5±0.03µs -2.17%
RegExp Literal Creation (Compiler) 1743.7±2.63ns 2.1±1.14µs +20.43%
RegExp Literal Creation (Execution) 8.3±0.02µs 7.6±3.11µs -8.43%
RegExp Literal Creation (Parser) 11.7±0.02µs 11.3±0.03µs -3.42%
Static Object Property Access (Compiler) 1791.8±6.90ns 2.3±1.22µs +28.36%
Static Object Property Access (Execution) 4.3±0.01µs 3.0±1.93µs -30.23%
Static Object Property Access (Parser) 12.3±0.06µs 12.4±0.02µs +0.81%
String Object Access (Compiler) 1516.6±1.99ns 2.1±1.08µs +38.47%
String Object Access (Execution) 5.5±0.01µs 5.7±2.44µs +3.64%
String Object Access (Parser) 17.5±0.04µs 17.2±0.02µs -1.71%
String comparison (Compiler) 2.5±0.00µs 3.0±1.61µs +20.00%
String comparison (Execution) 3.8±0.06µs 2.5±2.04µs -34.21%
String comparison (Parser) 14.1±0.01µs 13.9±0.02µs -1.42%
String concatenation (Compiler) 1990.3±3.70ns 2.6±2.96µs +30.63%
String concatenation (Execution) 3.5±0.01µs 2.5±2.48µs -28.57%
String concatenation (Parser) 9.6±0.02µs 9.6±0.11µs 0.00%
String copy (Compiler) 1643.8±4.86ns 2.0±1.36µs +21.67%
String copy (Execution) 3.3±0.01µs 1957.7±1348.12ns -40.68%
String copy (Parser) 7.2±0.01µs 7.1±0.01µs -1.39%
Symbols (Compiler) 1246.8±1.97ns 1599.9±1368.51ns +28.32%
Symbols (Execution) 3.3±0.01µs 2.1±1.51µs -36.36%
Symbols (Parser) 5.7±0.01µs 5.6±0.01µs -1.75%

@HalidOdat
Copy link
Member Author

In my case it seemed like it froze, but it was just the long execution time. The only benchmark that threw errors was RegExp I think.

I guess I just didn't wait long enough 😅 , I'll run them and update the comment once they finish :)

@github-actions
Copy link

github-actions bot commented Apr 9, 2023

Benchmark for ca274e0

Click to view benchmark
Test Base PR %
Arithmetic operations (Compiler) 570.8±0.95ns 630.4±412.19ns +10.44%
Arithmetic operations (Execution) 441.0±0.17ns 441.6±0.26ns +0.14%
Arithmetic operations (Parser) 7.1±0.01µs 7.1±0.01µs 0.00%
Array access (Compiler) 1652.6±2.47ns 1871.5±940.85ns +13.25%
Array access (Execution) 7.2±0.01µs 6.4±2.95µs -11.11%
Array access (Parser) 14.7±0.03µs 14.5±0.03µs -1.36%
Array creation (Compiler) 2.4±0.01µs 2.8±1.89µs +16.67%
Array creation (Execution) 1042.2±1.69µs 1141.1±320.35µs +9.49%
Array creation (Parser) 17.5±0.02µs 17.5±0.03µs 0.00%
Array pop (Compiler) 4.2±0.01µs 4.7±2.01µs +11.90%
Array pop (Execution) 603.4±6.66µs 618.5±155.32µs +2.50%
Array pop (Parser) 154.3±0.18µs 153.8±0.31µs -0.32%
Boolean Object Access (Compiler) 1200.6±1.12ns 1661.9±753.46ns +38.42%
Boolean Object Access (Execution) 4.0±0.01µs 4.2±2.04µs +5.00%
Boolean Object Access (Parser) 18.0±0.02µs 17.8±0.02µs -1.11%
Clean js (Compiler) 4.9±0.01µs 6.2±3.43µs +26.53%
Clean js (Execution) 591.5±4.08µs 694.2±164.17µs +17.36%
Clean js (Parser) 37.0±0.05µs 36.3±0.13µs -1.89%
Create Realm 465.9±1.19µs 476.7±616.26µs +2.32%
Dynamic Object Property Access (Compiler) 1924.6±3.86ns 2.3±1.58µs +19.51%
Dynamic Object Property Access (Execution) 4.5±0.02µs 3.5±3.76µs -22.22%
Dynamic Object Property Access (Parser) 13.2±0.02µs 13.0±0.02µs -1.52%
Fibonacci (Compiler) 3.0±0.01µs 3.4±1.61µs +13.33%
Fibonacci (Execution) 998.6±1.09µs 749.5±502.61µs -24.94%
Fibonacci (Parser) 20.7±0.02µs 20.6±0.02µs -0.48%
For loop (Compiler) 2.7±0.01µs 3.1±1.46µs +14.81%
For loop (Execution) 15.8±0.09µs 15.6±9.96µs -1.27%
For loop (Parser) 17.9±0.02µs 17.9±0.03µs 0.00%
Mini js (Compiler) 4.4±0.01µs 5.4±3.66µs +22.73%
Mini js (Execution) 543.7±2.49µs 620.5±79.25µs +14.13%
Mini js (Parser) 32.4±0.04µs 32.0±0.03µs -1.23%
Number Object Access (Compiler) 1124.4±2.34ns 1452.9±671.67ns +29.22%
Number Object Access (Execution) 3.0±0.00µs 3.4±1.95µs +13.33%
Number Object Access (Parser) 13.8±0.04µs 13.7±0.02µs -0.72%
Object Creation (Compiler) 1746.9±2.20ns 2.3±3.46µs +31.66%
Object Creation (Execution) 4.2±0.03µs 2.8±1.95µs -33.33%
Object Creation (Parser) 11.5±0.03µs 11.5±0.04µs 0.00%
RegExp (Compiler) 1946.4±3.47ns 2.3±1.15µs +18.17%
RegExp (Execution) 12.0±0.05µs 11.0±3.65µs -8.33%
RegExp (Parser) 12.6±0.02µs 12.6±0.02µs 0.00%
RegExp Creation (Compiler) 1717.9±2.74ns 2.0±1.09µs +16.42%
RegExp Creation (Execution) 8.5±0.03µs 7.6±3.91µs -10.59%
RegExp Creation (Parser) 10.6±0.01µs 10.6±0.02µs 0.00%
RegExp Literal (Compiler) 1941.0±2.63ns 2.3±1.27µs +18.50%
RegExp Literal (Execution) 12.0±0.05µs 11.1±4.75µs -7.50%
RegExp Literal (Parser) 13.7±0.02µs 13.8±0.03µs +0.73%
RegExp Literal Creation (Compiler) 1716.3±3.38ns 2.4±3.44µs +39.84%
RegExp Literal Creation (Execution) 8.5±0.03µs 7.3±2.43µs -14.12%
RegExp Literal Creation (Parser) 11.7±0.02µs 11.5±0.02µs -1.71%
Static Object Property Access (Compiler) 1777.1±2.70ns 2.1±1.08µs +18.17%
Static Object Property Access (Execution) 4.4±0.04µs 3.1±2.62µs -29.55%
Static Object Property Access (Parser) 12.3±0.02µs 12.5±0.39µs +1.63%
String Object Access (Compiler) 1513.3±2.32ns 2.2±1.28µs +45.38%
String Object Access (Execution) 5.5±0.01µs 5.9±2.36µs +7.27%
String Object Access (Parser) 17.4±0.02µs 17.2±0.02µs -1.15%
String comparison (Compiler) 2.5±0.00µs 3.6±7.89µs +44.00%
String comparison (Execution) 3.9±0.01µs 2.4±2.50µs -38.46%
String comparison (Parser) 14.1±0.02µs 14.0±0.02µs -0.71%
String concatenation (Compiler) 1972.6±3.07ns 2.4±1.43µs +21.67%
String concatenation (Execution) 3.6±0.01µs 2.3±1.66µs -36.11%
String concatenation (Parser) 9.6±0.20µs 9.5±0.02µs -1.04%
String copy (Compiler) 1619.0±1.96ns 1934.5±1166.43ns +19.49%
String copy (Execution) 3.4±0.01µs 1850.5±1032.01ns -45.57%
String copy (Parser) 7.2±0.02µs 7.2±0.01µs 0.00%
Symbols (Compiler) 1235.9±1.74ns 1506.7±1169.99ns +21.91%
Symbols (Execution) 3.5±0.01µs 2.1±1.68µs -40.00%
Symbols (Parser) 5.6±0.01µs 5.6±0.01µs 0.00%

@github-actions
Copy link

github-actions bot commented Apr 9, 2023

Benchmark for b6de08b

Click to view benchmark
Test Base PR %
Arithmetic operations (Compiler) 712.7±35.25ns 778.5±351.43ns +9.23%
Arithmetic operations (Execution) 570.4±50.46ns 627.5±55.46ns +10.01%
Arithmetic operations (Parser) 8.9±1.00µs 9.4±1.79µs +5.62%
Array access (Compiler) 2.1±0.16µs 2.3±1.07µs +9.52%
Array access (Execution) 9.7±0.54µs 8.0±3.01µs -17.53%
Array access (Parser) 19.0±1.05µs 18.8±1.20µs -1.05%
Array creation (Compiler) 3.2±0.17µs 3.7±2.28µs +15.63%
Array creation (Execution) 1250.3±66.97µs 1386.5±395.63µs +10.89%
Array creation (Parser) 23.7±1.77µs 23.6±3.25µs -0.42%
Array pop (Compiler) 5.2±0.31µs 5.9±2.51µs +13.46%
Array pop (Execution) 736.1±47.01µs 794.2±136.94µs +7.89%
Array pop (Parser) 199.6±11.82µs 195.7±11.44µs -1.95%
Boolean Object Access (Compiler) 1495.5±92.83ns 2.3±1.54µs +53.79%
Boolean Object Access (Execution) 5.3±0.52µs 5.2±2.06µs -1.89%
Boolean Object Access (Parser) 21.9±1.37µs 23.1±0.93µs +5.48%
Clean js (Compiler) 6.7±0.56µs 8.7±5.65µs +29.85%
Clean js (Execution) 793.7±54.05µs 925.8±337.89µs +16.64%
Clean js (Parser) 50.6±4.12µs 47.4±2.53µs -6.32%
Create Realm 556.7±36.82µs 694.1±890.72µs +24.68%
Dynamic Object Property Access (Compiler) 2.5±0.16µs 2.9±1.86µs +16.00%
Dynamic Object Property Access (Execution) 6.0±0.28µs 4.2±2.44µs -30.00%
Dynamic Object Property Access (Parser) 17.2±1.02µs 18.4±1.86µs +6.98%
Fibonacci (Compiler) 3.8±0.18µs 4.3±2.07µs +13.16%
Fibonacci (Execution) 1413.6±79.64µs 907.5±384.15µs -35.80%
Fibonacci (Parser) 28.7±1.80µs 26.3±1.35µs -8.36%
For loop (Compiler) 3.6±0.28µs 4.2±3.41µs +16.67%
For loop (Execution) 22.5±1.37µs 20.2±11.22µs -10.22%
For loop (Parser) 23.9±1.89µs 23.2±1.38µs -2.93%
Mini js (Compiler) 6.2±0.68µs 8.4±6.59µs +35.48%
Mini js (Execution) 698.9±40.03µs 804.0±81.69µs +15.04%
Mini js (Parser) 42.6±2.46µs 39.6±1.97µs -7.04%
Number Object Access (Compiler) 1455.1±134.12ns 2.0±1.01µs +37.45%
Number Object Access (Execution) 4.0±0.18µs 4.2±1.71µs +5.00%
Number Object Access (Parser) 17.3±0.88µs 17.9±0.85µs +3.47%
Object Creation (Compiler) 2.4±0.22µs 2.4±1.16µs 0.00%
Object Creation (Execution) 5.8±0.52µs 3.8±2.25µs -34.48%
Object Creation (Parser) 15.5±1.11µs 15.1±0.90µs -2.58%
RegExp (Compiler) 2.5±0.16µs 3.0±1.56µs +20.00%
RegExp (Execution) 16.0±0.82µs 15.1±6.72µs -5.63%
RegExp (Parser) 17.3±2.17µs 16.8±1.03µs -2.89%
RegExp Creation (Compiler) 2.2±0.37µs 2.6±1.35µs +18.18%
RegExp Creation (Execution) 11.1±0.70µs 10.3±8.00µs -7.21%
RegExp Creation (Parser) 14.5±1.61µs 14.5±1.17µs 0.00%
RegExp Literal (Compiler) 2.5±0.11µs 3.0±1.70µs +20.00%
RegExp Literal (Execution) 16.0±0.82µs 14.7±4.71µs -8.12%
RegExp Literal (Parser) 22.0±5.94µs 19.2±0.96µs -12.73%
RegExp Literal Creation (Compiler) 2.2±0.11µs 2.5±1.25µs +13.64%
RegExp Literal Creation (Execution) 11.1±0.42µs 10.2±4.12µs -8.11%
RegExp Literal Creation (Parser) 15.4±1.06µs 15.9±0.94µs +3.25%
Static Object Property Access (Compiler) 2.4±0.13µs 2.7±1.54µs +12.50%
Static Object Property Access (Execution) 6.0±0.26µs 3.7±2.13µs -38.33%
Static Object Property Access (Parser) 16.8±1.39µs 16.8±1.25µs 0.00%
String Object Access (Compiler) 1909.4±147.05ns 2.9±1.65µs +51.88%
String Object Access (Execution) 8.4±1.62µs 8.0±4.43µs -4.76%
String Object Access (Parser) 20.7±1.35µs 22.3±1.43µs +7.73%
String comparison (Compiler) 3.2±0.17µs 3.9±2.06µs +21.87%
String comparison (Execution) 5.4±0.30µs 2.8±1.53µs -48.15%
String comparison (Parser) 18.4±1.07µs 17.8±0.84µs -3.26%
String concatenation (Compiler) 2.6±0.25µs 3.0±1.63µs +15.38%
String concatenation (Execution) 4.8±0.27µs 2.8±1.61µs -41.67%
String concatenation (Parser) 13.0±0.95µs 12.1±0.63µs -6.92%
String copy (Compiler) 2.2±0.15µs 2.3±1.16µs +4.55%
String copy (Execution) 4.7±0.23µs 2.3±1.47µs -51.06%
String copy (Parser) 9.3±0.42µs 9.5±0.53µs +2.15%
Symbols (Compiler) 1698.6±114.78ns 1743.3±1415.42ns +2.63%
Symbols (Execution) 5.0±0.71µs 2.9±6.16µs -42.00%
Symbols (Parser) 7.1±0.51µs 7.2±0.37µs +1.41%

@HalidOdat HalidOdat force-pushed the optimization/inline-caching branch from fd93cd5 to 42acaa5 Compare April 9, 2023 10:14
@github-actions
Copy link

github-actions bot commented Apr 9, 2023

Benchmark for 54852e9

Click to view benchmark
Test Base PR %
Arithmetic operations (Compiler) 581.0±1.23ns 607.1±245.04ns +4.49%
Arithmetic operations (Execution) 441.2±0.13ns 448.6±1.19ns +1.68%
Arithmetic operations (Parser) 7.1±0.02µs 7.2±0.01µs +1.41%
Array access (Compiler) 1660.8±2.12ns 1917.4±1014.46ns +15.45%
Array access (Execution) 7.3±0.02µs 6.0±2.40µs -17.81%
Array access (Parser) 14.6±0.02µs 14.6±0.03µs 0.00%
Array creation (Compiler) 2.4±0.01µs 2.8±1.44µs +16.67%
Array creation (Execution) 1045.2±2.85µs 1143.4±308.75µs +9.40%
Array creation (Parser) 17.5±0.02µs 17.5±0.02µs 0.00%
Array pop (Compiler) 4.2±0.01µs 4.6±1.83µs +9.52%
Array pop (Execution) 599.2±0.80µs 617.2±145.30µs +3.00%
Array pop (Parser) 154.3±0.21µs 154.5±0.16µs +0.13%
Boolean Object Access (Compiler) 1205.9±1.05ns 1649.3±576.99ns +36.77%
Boolean Object Access (Execution) 3.9±0.00µs 3.9±1.51µs 0.00%
Boolean Object Access (Parser) 18.0±0.02µs 18.0±0.02µs 0.00%
Clean js (Compiler) 4.9±0.00µs 5.8±2.92µs +18.37%
Clean js (Execution) 599.9±3.03µs 690.5±197.40µs +15.10%
Clean js (Parser) 37.0±0.03µs 37.2±0.04µs +0.54%
Create Realm 461.2±2.05µs 484.3±682.79µs +5.01%
Dynamic Object Property Access (Compiler) 1963.4±2.68ns 2.2±1.19µs +12.05%
Dynamic Object Property Access (Execution) 4.5±0.01µs 3.1±1.82µs -31.11%
Dynamic Object Property Access (Parser) 13.1±0.02µs 13.1±0.02µs 0.00%
Fibonacci (Compiler) 3.1±0.01µs 3.4±1.67µs +9.68%
Fibonacci (Execution) 979.0±1.14µs 702.8±337.43µs -28.21%
Fibonacci (Parser) 20.8±0.03µs 20.7±0.14µs -0.48%
For loop (Compiler) 2.7±0.00µs 3.3±1.68µs +22.22%
For loop (Execution) 16.0±0.03µs 15.9±9.49µs -0.62%
For loop (Parser) 17.9±0.03µs 17.9±0.03µs 0.00%
Mini js (Compiler) 4.4±0.01µs 5.3±2.76µs +20.45%
Mini js (Execution) 544.2±2.07µs 625.5±159.05µs +14.94%
Mini js (Parser) 32.3±0.03µs 32.4±0.03µs +0.31%
Number Object Access (Compiler) 1144.6±13.20ns 1478.3±617.22ns +29.15%
Number Object Access (Execution) 3.0±0.01µs 3.3±1.68µs +10.00%
Number Object Access (Parser) 13.9±0.02µs 13.8±0.02µs -0.72%
Object Creation (Compiler) 1759.4±2.10ns 2.1±1.28µs +19.36%
Object Creation (Execution) 4.2±0.01µs 2.7±1.67µs -35.71%
Object Creation (Parser) 11.4±0.02µs 11.5±0.01µs +0.88%
RegExp (Compiler) 1982.3±4.72ns 2.4±1.50µs +21.07%
RegExp (Execution) 11.9±0.05µs 11.2±3.58µs -5.88%
RegExp (Parser) 12.6±0.02µs 12.6±0.02µs 0.00%
RegExp Creation (Compiler) 1753.1±2.40ns 2.1±1.05µs +19.79%
RegExp Creation (Execution) 8.5±0.17µs 7.8±5.18µs -8.24%
RegExp Creation (Parser) 10.6±0.02µs 10.7±0.01µs +0.94%
RegExp Literal (Compiler) 1962.3±3.44ns 2.3±1.19µs +17.21%
RegExp Literal (Execution) 11.9±0.04µs 11.3±3.78µs -5.04%
RegExp Literal (Parser) 13.7±0.02µs 13.7±0.02µs 0.00%
RegExp Literal Creation (Compiler) 1741.4±2.65ns 2.2±1.77µs +26.34%
RegExp Literal Creation (Execution) 8.4±0.02µs 7.4±2.60µs -11.90%
RegExp Literal Creation (Parser) 11.7±0.04µs 11.5±0.02µs -1.71%
Static Object Property Access (Compiler) 1790.7±4.92ns 2.3±1.90µs +28.44%
Static Object Property Access (Execution) 4.4±0.01µs 2.8±1.59µs -36.36%
Static Object Property Access (Parser) 12.2±0.02µs 12.4±0.01µs +1.64%
String Object Access (Compiler) 1519.4±1.88ns 2.2±1.74µs +44.79%
String Object Access (Execution) 5.5±0.01µs 5.8±2.43µs +5.45%
String Object Access (Parser) 17.5±0.11µs 17.3±0.03µs -1.14%
String comparison (Compiler) 2.5±0.00µs 3.1±2.39µs +24.00%
String comparison (Execution) 3.8±0.02µs 2.2±1.16µs -42.11%
String comparison (Parser) 14.0±0.02µs 14.1±0.02µs +0.71%
String concatenation (Compiler) 2000.0±1.78ns 2.7±2.07µs +35.00%
String concatenation (Execution) 3.6±0.01µs 2.3±1.69µs -36.11%
String concatenation (Parser) 9.6±0.02µs 9.6±0.02µs 0.00%
String copy (Compiler) 1635.6±2.04ns 2.0±1.43µs +22.28%
String copy (Execution) 3.4±0.01µs 1834.3±1396.28ns -46.05%
String copy (Parser) 7.2±0.01µs 7.3±0.01µs +1.39%
Symbols (Compiler) 1256.3±5.48ns 1504.8±1128.08ns +19.78%
Symbols (Execution) 3.5±0.05µs 1826.0±1001.26ns -47.83%
Symbols (Parser) 5.7±0.01µs 5.7±0.02µs 0.00%

@HalidOdat HalidOdat force-pushed the optimization/inline-caching branch from 9ebac0a to 509c580 Compare April 13, 2023 01:00
@HalidOdat HalidOdat marked this pull request as ready for review June 8, 2023 09:17
@HalidOdat HalidOdat requested a review from a team June 8, 2023 09:17
boa_engine/src/vm/code_block.rs Outdated Show resolved Hide resolved
boa_engine/src/object/shape/slot.rs Show resolved Hide resolved
boa_engine/src/vm/opcode/get/property.rs Outdated Show resolved Hide resolved
boa_engine/src/vm/opcode/get/property.rs Outdated Show resolved Hide resolved
boa_engine/src/vm/opcode/set/property.rs Outdated Show resolved Hide resolved
boa_engine/src/vm/opcode/set/property.rs Outdated Show resolved Hide resolved
@HalidOdat HalidOdat force-pushed the optimization/inline-caching branch from f54df56 to 82e67e6 Compare June 9, 2023 22:16
@HalidOdat HalidOdat requested a review from raskad June 9, 2023 22:17
@HalidOdat HalidOdat force-pushed the optimization/inline-caching branch from 82e67e6 to bda8fcd Compare June 11, 2023 14:24
@github-actions
Copy link

Benchmark for 6ab0926

Click to view benchmark
Test Base PR %
Arithmetic operations (Compiler) 17.7±1.05ns 19.5±1.53ns +10.17%
Arithmetic operations (Execution) 481.0±22.56ns 501.2±23.14ns +4.20%
Arithmetic operations (Parser) 7.7±0.35µs 7.8±0.41µs +1.30%
Array access (Compiler) 17.1±0.81ns 17.5±1.12ns +2.34%
Array access (Execution) 7.1±8.79µs 7.5±9.06µs +5.63%
Array access (Parser) 13.9±1.22µs 13.8±1.05µs -0.72%
Array creation (Compiler) 17.3±0.79ns 17.2±0.75ns -0.58%
Array creation (Execution) 1099.7±734.06µs 991.3±832.71µs -9.86%
Array creation (Parser) 15.8±0.80µs 18.0±0.91µs +13.92%
Array pop (Compiler) 18.2±1.13ns 17.6±0.92ns -3.30%
Array pop (Execution) 455.7±27.88µs 410.8±188.21µs -9.85%
Array pop (Parser) 154.6±10.43µs 168.6±5.39µs +9.06%
Boolean Object Access (Compiler) 19.1±0.73ns 18.5±1.37ns -3.14%
Boolean Object Access (Execution) 7.7±10.38µs 7.1±5.25µs -7.79%
Boolean Object Access (Parser) 14.9±0.82µs 17.0±0.92µs +14.09%
Clean js (Compiler) 17.6±0.94ns 19.9±1.44ns +13.07%
Clean js (Execution) 785.6±428.86µs 790.1±319.97µs +0.57%
Clean js (Parser) 45.1±9.71µs 37.4±8.12µs -17.07%
Create Realm 741.0±3316.75µs 736.4±3280.87µs -0.62%
Dynamic Object Property Access (Compiler) 18.2±0.97ns 17.6±0.90ns -3.30%
Dynamic Object Property Access (Execution) 4.7±6.09µs 5.4±14.09µs +14.89%
Dynamic Object Property Access (Parser) 30.9±191.87µs 29.6±175.85µs -4.21%
Fibonacci (Compiler) 17.4±0.97ns 17.2±0.59ns -1.15%
Fibonacci (Execution) 1164.2±2387.77µs 1333.0±4721.73µs +14.50%
Fibonacci (Parser) 18.7±1.18µs 18.9±0.98µs +1.07%
For loop (Compiler) 17.3±0.91ns 17.9±1.35ns +3.47%
For loop (Execution) 42.7±157.92µs 45.8±203.29µs +7.26%
For loop (Parser) 17.0±0.77µs 16.5±0.81µs -2.94%
Mini js (Compiler) 17.5±0.65ns 17.3±0.82ns -1.14%
Mini js (Execution) 743.8±45.09µs 685.1±23.69µs -7.89%
Mini js (Parser) 39.2±10.34µs 36.7±6.59µs -6.38%
Number Object Access (Compiler) 19.3±0.72ns 17.4±0.94ns -9.84%
Number Object Access (Execution) 5.6±5.48µs 6.2±8.04µs +10.71%
Number Object Access (Parser) 12.5±0.91µs 46.0±310.41µs +268.00%
Object Creation (Compiler) 17.5±0.80ns 17.8±1.04ns +1.71%
Object Creation (Execution) 4.7±7.37µs 4.5±7.93µs -4.26%
Object Creation (Parser) 10.0±0.62µs 10.2±0.60µs +2.00%
RegExp (Compiler) 17.2±0.55ns 17.4±0.80ns +1.16%
RegExp (Execution) 14.9±20.12µs 15.0±21.52µs +0.67%
RegExp (Parser) 11.4±0.54µs 11.7±0.70µs +2.63%
RegExp Creation (Compiler) 17.3±0.90ns 17.5±0.76ns +1.16%
RegExp Creation (Execution) 11.5±27.12µs 10.3±13.35µs -10.43%
RegExp Creation (Parser) 9.8±0.65µs 9.3±0.51µs -5.10%
RegExp Literal (Compiler) 17.0±0.66ns 17.2±0.56ns +1.18%
RegExp Literal (Execution) 13.0±8.17µs 15.5±24.64µs +19.23%
RegExp Literal (Parser) 14.0±0.85µs 14.4±1.00µs +2.86%
RegExp Literal Creation (Compiler) 17.6±0.69ns 17.1±0.66ns -2.84%
RegExp Literal Creation (Execution) 8.7±6.22µs 11.2±21.76µs +28.74%
RegExp Literal Creation (Parser) 11.2±0.63µs 12.0±0.73µs +7.14%
Static Object Property Access (Compiler) 17.4±0.93ns 19.0±1.20ns +9.20%
Static Object Property Access (Execution) 4.7±6.47µs 4.7±9.01µs 0.00%
Static Object Property Access (Parser) 10.7±0.53µs 11.2±0.57µs +4.67%
String Object Access (Compiler) 18.9±1.33ns 20.0±1.03ns +5.82%
String Object Access (Execution) 8.3±6.02µs 8.1±6.45µs -2.41%
String Object Access (Parser) 14.7±0.61µs 14.8±0.68µs +0.68%
String comparison (Compiler) 19.5±0.81ns 17.5±0.85ns -10.26%
String comparison (Execution) 4.1±4.66µs 5.3±14.18µs +29.27%
String comparison (Parser) 14.9±2.09µs 13.3±0.54µs -10.74%
String concatenation (Compiler) 18.7±1.58ns 17.9±0.98ns -4.28%
String concatenation (Execution) 4.2±7.08µs 3.4±4.13µs -19.05%
String concatenation (Parser) 8.9±0.48µs 9.1±0.50µs +2.25%
String copy (Compiler) 19.2±0.91ns 17.4±1.13ns -9.38%
String copy (Execution) 3.4±5.19µs 3.5±4.54µs +2.94%
String copy (Parser) 25.7±174.79µs 7.1±0.65µs -72.37%
Symbols (Compiler) 17.2±0.55ns 17.4±1.25ns +1.16%
Symbols (Execution) 4.5±0.61µs 3.1±0.59µs -31.11%
Symbols (Parser) 5.2±3.51µs 5.2±3.77µs 0.00%

@HalidOdat HalidOdat force-pushed the optimization/inline-caching branch from bda8fcd to 37b1a64 Compare June 26, 2023 18:51
@HalidOdat HalidOdat requested a review from jedel1043 June 26, 2023 19:20
@github-actions
Copy link

Benchmark for 1a0328e

Click to view benchmark
Test Base PR %
Arithmetic operations (Compiler) 17.1±0.90ns 16.0±0.56ns -6.43%
Arithmetic operations (Execution) 481.2±15.52ns 497.9±42.75ns +3.47%
Arithmetic operations (Parser) 8.9±3.51µs 8.4±0.72µs -5.62%
Array access (Compiler) 16.6±0.58ns 16.0±0.53ns -3.61%
Array access (Execution) 6.6±7.00µs 6.7±5.82µs +1.52%
Array access (Parser) 14.4±0.78µs 14.4±0.93µs 0.00%
Array creation (Compiler) 16.6±0.60ns 16.0±0.42ns -3.61%
Array creation (Execution) 950.6±631.48µs 964.6±776.99µs +1.47%
Array creation (Parser) 20.4±1.96µs 19.3±1.66µs -5.39%
Array pop (Compiler) 17.1±1.82ns 16.0±0.51ns -6.43%
Array pop (Execution) 444.5±264.90µs 417.7±399.92µs -6.03%
Array pop (Parser) 182.3±23.66µs 481.8±2969.55µs +164.29%
Boolean Object Access (Compiler) 16.7±0.63ns 16.1±0.47ns -3.59%
Boolean Object Access (Execution) 7.5±5.54µs 7.2±7.76µs -4.00%
Boolean Object Access (Parser) 16.3±1.05µs 15.8±0.98µs -3.07%
Clean js (Compiler) 16.9±0.70ns 16.2±0.88ns -4.14%
Clean js (Execution) 791.1±289.19µs 779.0±287.20µs -1.53%
Clean js (Parser) 39.1±2.41µs 39.1±1.98µs 0.00%
Create Realm 1847.2±13421.41µs 1788.8±12632.89µs -3.16%
Dynamic Object Property Access (Compiler) 17.0±1.27ns 16.1±0.67ns -5.29%
Dynamic Object Property Access (Execution) 4.5±6.12µs 4.7±5.35µs +4.44%
Dynamic Object Property Access (Parser) 14.4±0.56µs 14.2±0.93µs -1.39%
Fibonacci (Compiler) 16.6±0.68ns 16.6±0.76ns 0.00%
Fibonacci (Execution) 1009.9±1255.20µs 1157.9±2658.48µs +14.65%
Fibonacci (Parser) 20.4±1.17µs 21.0±0.80µs +2.94%
For loop (Compiler) 16.6±0.85ns 16.4±0.99ns -1.20%
For loop (Execution) 29.4±57.88µs 26.8±38.18µs -8.84%
For loop (Parser) 19.5±1.13µs 18.7±1.14µs -4.10%
Mini js (Compiler) 17.2±1.39ns 16.1±0.73ns -6.40%
Mini js (Execution) 699.8±25.13µs 705.9±25.50µs +0.87%
Mini js (Parser) 35.0±1.89µs 39.3±15.98µs +12.29%
Number Object Access (Compiler) 16.9±0.84ns 16.2±0.57ns -4.14%
Number Object Access (Execution) 5.6±5.79µs 6.2±10.18µs +10.71%
Number Object Access (Parser) 13.1±0.80µs 13.1±0.73µs 0.00%
Object Creation (Compiler) 16.7±0.76ns 16.5±1.34ns -1.20%
Object Creation (Execution) 4.1±5.40µs 4.6±8.37µs +12.20%
Object Creation (Parser) 11.6±0.62µs 12.0±1.27µs +3.45%
RegExp (Compiler) 16.6±0.71ns 16.4±1.23ns -1.20%
RegExp (Execution) 15.8±16.99µs 13.9±8.49µs -12.03%
RegExp (Parser) 13.0±1.05µs 12.4±0.58µs -4.62%
RegExp Creation (Compiler) 17.1±0.96ns 16.2±0.91ns -5.26%
RegExp Creation (Execution) 10.4±10.86µs 10.1±7.10µs -2.88%
RegExp Creation (Parser) 10.5±0.60µs 9.8±0.42µs -6.67%
RegExp Literal (Compiler) 16.8±0.79ns 16.3±0.74ns -2.98%
RegExp Literal (Execution) 16.6±26.77µs 14.6±10.27µs -12.05%
RegExp Literal (Parser) 15.7±0.98µs 15.5±1.16µs -1.27%
RegExp Literal Creation (Compiler) 16.8±0.77ns 16.5±1.18ns -1.79%
RegExp Literal Creation (Execution) 10.5±10.94µs 10.2±7.56µs -2.86%
RegExp Literal Creation (Parser) 39.6±257.80µs 44.0±304.84µs +11.11%
Static Object Property Access (Compiler) 16.7±1.01ns 16.3±0.95ns -2.40%
Static Object Property Access (Execution) 6.8±30.11µs 4.3±5.06µs -36.76%
Static Object Property Access (Parser) 12.4±0.80µs 12.7±0.75µs +2.42%
String Object Access (Compiler) 16.9±1.22ns 16.1±0.52ns -4.73%
String Object Access (Execution) 9.7±8.70µs 8.6±7.29µs -11.34%
String Object Access (Parser) 17.0±1.12µs 15.7±0.75µs -7.65%
String comparison (Compiler) 16.9±1.09ns 16.1±0.73ns -4.73%
String comparison (Execution) 4.2±5.58µs 4.8±11.07µs +14.29%
String comparison (Parser) 15.7±3.81µs 15.1±0.95µs -3.82%
String concatenation (Compiler) 17.2±0.71ns 16.1±0.56ns -6.40%
String concatenation (Execution) 3.9±6.32µs 4.5±11.95µs +15.38%
String concatenation (Parser) 10.8±1.24µs 9.7±0.64µs -10.19%
String copy (Compiler) 17.4±1.54ns 16.3±0.68ns -6.32%
String copy (Execution) 3.2±4.18µs 3.5±5.64µs +9.37%
String copy (Parser) 7.6±0.46µs 7.5±0.55µs -1.32%
Symbols (Compiler) 16.8±0.80ns 16.9±1.76ns +0.60%
Symbols (Execution) 3.1±4.50µs 2.6±0.36µs -16.13%
Symbols (Parser) 5.9±4.85µs 5.9±4.42µs 0.00%

@jedel1043 jedel1043 added the waiting-on-author Waiting on PR changes from the author label Nov 29, 2023
@jedel1043 jedel1043 mentioned this pull request Nov 29, 2023
28 tasks
@HalidOdat HalidOdat force-pushed the optimization/inline-caching branch from 37b1a64 to 8365e91 Compare November 30, 2023 14:17
Copy link

Benchmark for 0224993

Click to view benchmark
Test Base PR %
Arithmetic operations (Compiler) 4.4±0.14ns 4.1±0.32ns -6.82%
Arithmetic operations (Execution) 644.5±21.37ns 654.2±10.85ns +1.51%
Arithmetic operations (Parser) 7.3±0.28µs 7.3±0.34µs 0.00%
Array access (Compiler) 4.4±0.27ns 4.1±0.27ns -6.82%
Array access (Execution) 5.2±8.06µs 6.7±16.71µs +28.85%
Array access (Parser) 13.5±0.42µs 13.5±0.60µs 0.00%
Array creation (Compiler) 4.3±0.08ns 4.2±0.71ns -2.33%
Array creation (Execution) 653.8±490.98µs 667.4±655.69µs +2.08%
Array creation (Parser) 16.5±0.58µs 16.7±0.70µs +1.21%
Array pop (Compiler) 4.4±0.36ns 4.0±0.09ns -9.09%
Array pop (Execution) 276.0±9.24µs 266.0±176.51µs -3.62%
Array pop (Parser) 151.5±6.64µs 146.5±4.46µs -3.30%
Boolean Object Access (Compiler) 4.5±0.60ns 4.1±0.18ns -8.89%
Boolean Object Access (Execution) 4.3±3.05µs 4.2±3.38µs -2.33%
Boolean Object Access (Parser) 15.1±1.39µs 15.8±1.09µs +4.64%
Clean js (Compiler) 4.4±0.31ns 4.1±0.41ns -6.82%
Clean js (Execution) 595.3±18.24µs 635.8±717.69µs +6.80%
Clean js (Parser) 36.3±0.45µs 36.3±1.48µs 0.00%
Create Realm 415.8±1598.60µs 405.4±1630.35µs -2.50%
Dynamic Object Property Access (Compiler) 4.3±0.05ns 4.1±0.19ns -4.65%
Dynamic Object Property Access (Execution) 3.2±9.90µs 3.3±8.38µs +3.12%
Dynamic Object Property Access (Parser) 11.7±0.52µs 11.6±0.23µs -0.85%
Fibonacci (Compiler) 4.4±0.14ns 4.1±0.16ns -6.82%
Fibonacci (Execution) 761.0±1800.10µs 739.4±1655.84µs -2.84%
Fibonacci (Parser) 18.7±0.60µs 18.8±0.71µs +0.53%
For loop (Compiler) 4.4±0.34ns 4.0±0.08ns -9.09%
For loop (Execution) 16.6±26.60µs 17.2±25.98µs +3.61%
For loop (Parser) 17.0±0.40µs 17.0±0.39µs 0.00%
Mini js (Compiler) 4.4±0.38ns 4.1±0.48ns -6.82%
Mini js (Execution) 697.0±1423.72µs 538.2±10.15µs -22.78%
Mini js (Parser) 30.5±1.10µs 30.5±0.86µs 0.00%
Number Object Access (Compiler) 4.3±0.04ns 4.0±0.13ns -6.98%
Number Object Access (Execution) 4.0±5.53µs 3.7±3.37µs -7.50%
Number Object Access (Parser) 11.8±0.39µs 11.7±0.42µs -0.85%
Object Creation (Compiler) 4.4±0.31ns 4.1±0.39ns -6.82%
Object Creation (Execution) 3.8±15.32µs 3.9±14.64µs +2.63%
Object Creation (Parser) 10.3±0.23µs 10.3±0.27µs 0.00%
RegExp (Compiler) 4.4±0.21ns 4.1±0.29ns -6.82%
RegExp (Execution) 11.7±16.75µs 10.7±12.61µs -8.55%
RegExp (Parser) 10.8±0.57µs 10.9±0.84µs +0.93%
RegExp Creation (Compiler) 4.4±0.21ns 4.1±0.14ns -6.82%
RegExp Creation (Execution) 5.6±10.91µs 6.2±9.72µs +10.71%
RegExp Creation (Parser) 9.1±0.09µs 9.1±0.29µs 0.00%
RegExp Literal (Compiler) 4.4±0.33ns 4.1±0.36ns -6.82%
RegExp Literal (Execution) 11.0±18.65µs 9.0±10.76µs -18.18%
RegExp Literal (Parser) 11.4±0.15µs 11.3±0.33µs -0.88%
RegExp Literal Creation (Compiler) 4.4±0.22ns 4.0±0.08ns -9.09%
RegExp Literal Creation (Execution) 9.9±48.41µs 6.0±12.93µs -39.39%
RegExp Literal Creation (Parser) 9.7±0.12µs 9.5±0.27µs -2.06%
Static Object Property Access (Compiler) 4.3±0.05ns 4.1±0.21ns -4.65%
Static Object Property Access (Execution) 2.8±7.80µs 2.8±7.10µs 0.00%
Static Object Property Access (Parser) 10.8±0.22µs 10.8±0.42µs 0.00%
String Object Access (Compiler) 4.4±0.30ns 4.0±0.12ns -9.09%
String Object Access (Execution) 6.4±3.98µs 6.1±6.66µs -4.69%
String Object Access (Parser) 15.3±0.45µs 15.0±0.77µs -1.96%
String comparison (Compiler) 4.4±0.24ns 4.3±0.79ns -2.27%
String comparison (Execution) 5.0±23.51µs 3.4±7.86µs -32.00%
String comparison (Parser) 13.9±1.30µs 13.7±0.63µs -1.44%
String concatenation (Compiler) 4.3±0.08ns 4.0±0.12ns -6.98%
String concatenation (Execution) 2.3±6.71µs 2.2±5.90µs -4.35%
String concatenation (Parser) 9.2±0.17µs 9.2±0.43µs 0.00%
String copy (Compiler) 4.4±0.26ns 4.1±0.26ns -6.82%
String copy (Execution) 2.3±6.84µs 2.1±6.31µs -8.70%
String copy (Parser) 6.7±0.30µs 6.7±0.40µs 0.00%
Symbols (Compiler) 4.4±0.32ns 4.0±0.10ns -9.09%
Symbols (Execution) 2.3±6.66µs 2.5±6.99µs +8.70%
Symbols (Parser) 5.1±0.12µs 5.1±0.19µs 0.00%

@HalidOdat HalidOdat requested a review from a team December 3, 2023 16:29
@HalidOdat HalidOdat added this to the v0.18.0 milestone Dec 3, 2023
@HalidOdat HalidOdat removed the waiting-on-author Waiting on PR changes from the author label Dec 3, 2023
@jedel1043
Copy link
Member

jedel1043 commented Dec 4, 2023

Just throwing some ideas into the mix. InternalObjectMethods has some semblance to an ExecutionContext (not spec related, just a context that has data only used at execution), so maybe we could transition in the future to requiring an ExecutionContext on all functions and only having a function that converts a &mut Context into an ExecutionContext on demand.

Copy link
Member

@raskad raskad left a comment

Choose a reason for hiding this comment

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

I really like the feature and the changes. All seems very logical.

This should not hold up the merge, but I think it would be very nice if we could test this feature. Due to all the different components that are required to make it work, it may be that some future work accidentally could change some vital logic. I'm not 100% sure how to best test it, but maybe you have something in mind @HalidOdat

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.

Forgot to approve this. Really nice optimization work!

Also, agreed with Raskad that this should be tested somehow, but that can be done in a separate PR.

@HalidOdat
Copy link
Member Author

maybe we could transition in the future to requiring an ExecutionContext on all functions and only having a function that converts a &mut Context into an ExecutionContext on demand.

You mean having an a struct for functions (like we do for internal object methods) that contains this, arguments and the &mut Context (all the function arguments), right?

If that's the case than I totally agree. The neon crate has this where they have multiple context type that all deref into the main context type. It's easier than having multiple function argument and adding/removing/changing something is really hard (requires touching every function). We could completely remove helper traits like the JsArgs one and have a method on that specialized context.

@jedel1043
Copy link
Member

You mean having an a struct for functions (like we do for internal object methods) that contains this, arguments and the &mut Context (all the function arguments), right?

Yes! That would make it easier to preserve data between calls, and it could enable interesting optimizations.

@HalidOdat HalidOdat force-pushed the optimization/inline-caching branch from 8365e91 to 2ff6c51 Compare December 4, 2023 21:22
Copy link

github-actions bot commented Dec 4, 2023

Benchmark for 5a64da3

Click to view benchmark
Test Base PR %
Arithmetic operations (Compiler) 4.7±0.34ns 4.8±0.04ns +2.13%
Arithmetic operations (Execution) 678.5±7.62ns 612.6±32.93ns -9.71%
Arithmetic operations (Parser) 7.5±0.49µs 7.5±0.59µs 0.00%
Array access (Compiler) 4.7±0.07ns 4.8±0.20ns +2.13%
Array access (Execution) 5.2±3.89µs 5.6±7.51µs +7.69%
Array access (Parser) 13.2±0.23µs 13.2±0.52µs 0.00%
Array creation (Compiler) 4.7±0.19ns 4.8±0.09ns +2.13%
Array creation (Execution) 683.2±1003.84µs 638.9±463.04µs -6.48%
Array creation (Parser) 16.1±0.56µs 16.0±0.30µs -0.62%
Array pop (Compiler) 4.7±0.07ns 4.8±0.25ns +2.13%
Array pop (Execution) 332.2±134.48µs 232.9±8.82µs -29.89%
Array pop (Parser) 150.2±2.91µs 152.2±10.67µs +1.33%
Boolean Object Access (Compiler) 4.7±0.15ns 4.8±0.18ns +2.13%
Boolean Object Access (Execution) 4.8±5.24µs 3.8±2.45µs -20.83%
Boolean Object Access (Parser) 14.8±0.28µs 14.9±1.05µs +0.68%
Clean js (Compiler) 4.7±0.08ns 4.8±0.20ns +2.13%
Clean js (Execution) 598.0±265.66µs 544.0±27.23µs -9.03%
Clean js (Parser) 34.5±2.05µs 35.1±1.76µs +1.74%
Create Realm 341.7±1007.49µs 346.5±1045.18µs +1.40%
Dynamic Object Property Access (Compiler) 4.7±0.15ns 4.8±0.49ns +2.13%
Dynamic Object Property Access (Execution) 3.3±3.69µs 3.4±4.71µs +3.03%
Dynamic Object Property Access (Parser) 12.0±0.33µs 12.1±0.59µs +0.83%
Fibonacci (Compiler) 4.7±0.35ns 4.8±0.05ns +2.13%
Fibonacci (Execution) 684.6±764.32µs 715.1±851.59µs +4.46%
Fibonacci (Parser) 18.6±0.67µs 18.4±0.36µs -1.08%
For loop (Compiler) 4.7±0.29ns 5.7±0.13ns +21.28%
For loop (Execution) 15.6±16.88µs 14.5±14.77µs -7.05%
For loop (Parser) 17.4±0.57µs 17.6±1.65µs +1.15%
Mini js (Compiler) 4.7±0.08ns 4.8±0.08ns +2.13%
Mini js (Execution) 540.3±17.51µs 522.2±13.67µs -3.35%
Mini js (Parser) 29.8±1.39µs 34.1±4.20µs +14.43%
Number Object Access (Compiler) 4.7±0.24ns 4.8±0.04ns +2.13%
Number Object Access (Execution) 3.4±1.54µs 3.2±2.00µs -5.88%
Number Object Access (Parser) 12.2±1.09µs 12.0±0.95µs -1.64%
Object Creation (Compiler) 4.7±0.18ns 4.7±0.04ns 0.00%
Object Creation (Execution) 2.9±3.37µs 3.0±3.95µs +3.45%
Object Creation (Parser) 10.1±0.15µs 10.1±0.12µs 0.00%
RegExp (Compiler) 4.7±0.36ns 4.8±0.40ns +2.13%
RegExp (Execution) 10.8±7.58µs 10.5±10.98µs -2.78%
RegExp (Parser) 10.9±0.46µs 10.8±0.23µs -0.92%
RegExp Creation (Compiler) 4.7±0.15ns 4.8±0.21ns +2.13%
RegExp Creation (Execution) 5.6±4.22µs 5.9±5.73µs +5.36%
RegExp Creation (Parser) 9.4±0.35µs 9.2±0.27µs -2.13%
RegExp Literal (Compiler) 4.7±0.11ns 4.8±0.13ns +2.13%
RegExp Literal (Execution) 9.6±7.11µs 9.9±9.40µs +3.13%
RegExp Literal (Parser) 11.4±0.18µs 11.4±0.16µs 0.00%
RegExp Literal Creation (Compiler) 4.7±0.37ns 4.8±0.09ns +2.13%
RegExp Literal Creation (Execution) 5.6±6.70µs 6.4±13.32µs +14.29%
RegExp Literal Creation (Parser) 9.8±0.42µs 9.9±0.64µs +1.02%
Static Object Property Access (Compiler) 4.7±0.26ns 4.8±0.35ns +2.13%
Static Object Property Access (Execution) 3.6±6.89µs 2.8±3.12µs -22.22%
Static Object Property Access (Parser) 12.8±19.61µs 12.7±19.97µs -0.78%
String Object Access (Compiler) 4.7±0.30ns 4.8±0.10ns +2.13%
String Object Access (Execution) 7.1±8.22µs 5.6±3.45µs -21.13%
String Object Access (Parser) 14.8±0.30µs 14.7±0.23µs -0.68%
String comparison (Compiler) 4.7±0.23ns 4.8±0.35ns +2.13%
String comparison (Execution) 2.6±2.78µs 2.8±3.22µs +7.69%
String comparison (Parser) 13.9±0.29µs 13.9±0.46µs 0.00%
String concatenation (Compiler) 4.7±0.27ns 4.9±0.36ns +4.26%
String concatenation (Execution) 3.3±11.62µs 2.2±2.82µs -33.33%
String concatenation (Parser) 12.8±37.45µs 13.3±38.23µs +3.91%
String copy (Compiler) 4.7±0.39ns 4.8±0.17ns +2.13%
String copy (Execution) 2.3±3.65µs 2.4±3.98µs +4.35%
String copy (Parser) 6.9±0.16µs 6.9±0.26µs 0.00%
Symbols (Compiler) 4.7±0.23ns 4.8±0.32ns +2.13%
Symbols (Execution) 1175.3±127.93ns 1237.6±466.18ns +5.30%
Symbols (Parser) 5.1±0.14µs 5.2±0.13µs +1.96%

@jedel1043 jedel1043 added this pull request to the merge queue Dec 4, 2023
Merged via the queue into main with commit a9c33cd Dec 4, 2023
14 checks passed
@HalidOdat HalidOdat deleted the optimization/inline-caching branch December 4, 2023 22:13
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 run-benchmark Label used to run banchmarks on PRs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants