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

Optimization fast local variables #3194

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

HalidOdat
Copy link
Member

@HalidOdat HalidOdat commented Aug 1, 2023

Depends on #3185

This PR is a WIP, it implements an optimization on function local variables, functions that do not call eval directly or variables that are not escaped, we can keep then on the stack after frame pointer and use and offset to index them (index = fp + offset). This allows us to eliminate the creation of some of the gc collected environments. Which gives us huge performance improvements!

Benchmarks

Main

Uncaught Error: Benchmark had 1 errors
PROGRESS Richards
RESULT Richards 36.0
PROGRESS DeltaBlue
RESULT DeltaBlue 42.2
PROGRESS Encrypt
PROGRESS Decrypt
RESULT Crypto 63.2
PROGRESS RayTrace
RESULT RayTrace 147
PROGRESS Earley
PROGRESS Boyer
RESULT EarleyBoyer 136
ERROR RegExp TypeError: not a constructor
undefined
PROGRESS RegExp
PROGRESS Splay
RESULT Splay 118
PROGRESS NavierStokes
RESULT NavierStokes 136
SCORE 84.6
Uncaught Error: Benchmark had 1 errors

PR

PROGRESS Richards
RESULT Richards 42.3
PROGRESS DeltaBlue
RESULT DeltaBlue 46.5
PROGRESS Encrypt
PROGRESS Decrypt
RESULT Crypto 102
PROGRESS RayTrace
RESULT RayTrace 164
PROGRESS Earley
PROGRESS Boyer
RESULT EarleyBoyer 158
ERROR RegExp TypeError: not a constructor
undefined
PROGRESS RegExp
PROGRESS Splay
RESULT Splay 124
PROGRESS NavierStokes
RESULT NavierStokes 246
SCORE 107

Almost 2x improvment on NavierStokes :)

@HalidOdat HalidOdat added performance Performance related changes and issues execution Issues or PRs related to code execution vm Issues and PRs related to the Boa Virtual Machine. labels Aug 1, 2023
@HalidOdat HalidOdat changed the base branch from main to use-one-stack August 1, 2023 14:13
@HalidOdat HalidOdat marked this pull request as draft August 1, 2023 14:17
@github-actions
Copy link

github-actions bot commented Aug 1, 2023

Test262 conformance changes

Test result main count PR count difference
Total 95,574 95,574 0
Passed 75,273 75,273 0
Ignored 19,482 19,482 0
Failed 819 819 0
Panics 0 0 0
Conformance 78.76% 78.76% 0.00%

@codecov
Copy link

codecov bot commented Aug 1, 2023

Codecov Report

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

Comparison is base (a51581b) 49.53% compared to head (d53a0c4) 49.60%.
Report is 5 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3194      +/-   ##
==========================================
+ Coverage   49.53%   49.60%   +0.06%     
==========================================
  Files         446      446              
  Lines       43722    44070     +348     
==========================================
+ Hits        21659    21861     +202     
- Misses      22063    22209     +146     
Files Coverage Δ
boa_engine/src/bytecompiler/expression/assign.rs 42.13% <100.00%> (+3.88%) ⬆️
...gine/src/bytecompiler/expression/object_literal.rs 54.16% <100.00%> (ø)
boa_engine/src/bytecompiler/expression/unary.rs 100.00% <100.00%> (ø)
boa_engine/src/bytecompiler/function.rs 97.40% <100.00%> (-2.60%) ⬇️
boa_engine/src/bytecompiler/jump_control.rs 94.47% <100.00%> (+0.05%) ⬆️
boa_engine/src/bytecompiler/statement/block.rs 100.00% <100.00%> (ø)
boa_engine/src/bytecompiler/statement/loop.rs 77.23% <100.00%> (+2.13%) ⬆️
boa_engine/src/bytecompiler/statement/mod.rs 91.17% <100.00%> (ø)
boa_engine/src/bytecompiler/statement/switch.rs 100.00% <100.00%> (ø)
boa_engine/src/bytecompiler/statement/try.rs 91.11% <100.00%> (+0.20%) ⬆️
... and 17 more

... and 3 files with indirect coverage changes

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

Base automatically changed from use-one-stack to main August 12, 2023 19:09
@HalidOdat HalidOdat force-pushed the optimization/fast-local-variables branch from 8f055b5 to 2d454cb Compare September 16, 2023 16:05
@HalidOdat HalidOdat force-pushed the optimization/fast-local-variables branch 3 times, most recently from 933900d to fedf269 Compare September 28, 2023 14:06
@HalidOdat HalidOdat force-pushed the optimization/fast-local-variables branch 2 times, most recently from 8fa5cb8 to b7c9230 Compare October 4, 2023 12:49
@HalidOdat HalidOdat force-pushed the optimization/fast-local-variables branch from b7c9230 to e23ec27 Compare October 4, 2023 12:53
@HalidOdat HalidOdat added the run-benchmark Label used to run banchmarks on PRs label Oct 4, 2023
@jedel1043 jedel1043 added the blocked Waiting for another code change label Nov 29, 2023
@jedel1043
Copy link
Member

Blocked on #3490

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked Waiting for another code change execution Issues or PRs related to code execution performance Performance related changes and issues run-benchmark Label used to run banchmarks on PRs vm Issues and PRs related to the Boa Virtual Machine.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants