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] - Store call frames in Vec instead of singly-linked list #2164

Closed
wants to merge 1 commit into from

Conversation

HalidOdat
Copy link
Member

This storage method should be more cache friendly since we store in contiguous memory, besides that it should make #2157 a bit easier. Will work on that next after this gets merged :)

It changes the following:

  • Remove the unneeded prev field in CallFrame
  • Preallocate some space for future calls (16 slots)

@HalidOdat HalidOdat added Internal Category for changelog run-benchmark Label used to run banchmarks on PRs labels Jul 4, 2022
@github-actions
Copy link

github-actions bot commented Jul 4, 2022

Test262 conformance changes

VM implementation

Test result main count PR count difference
Total 90,831 88,985 -1,846
Passed 59,090 59,084 -6
Ignored 13,996 12,244 -1,752
Failed 17,745 17,657 -88
Panics 0 0 0
Conformance 65.05% 66.40% +1.34%
Fixed tests (2):
test/language/statements/for/head-const-bound-names-in-stmt.js [strict mode] (previously Failed)
test/language/statements/for/head-const-bound-names-in-stmt.js (previously Failed)

@codecov
Copy link

codecov bot commented Jul 4, 2022

Codecov Report

Merging #2164 (80299b8) into main (cdc49e3) will increase coverage by 0.26%.
The diff coverage is 27.27%.

❗ Current head 80299b8 differs from pull request most recent head 5e20795. Consider uploading reports for the commit 5e20795 to get more accurate results

@@            Coverage Diff             @@
##             main    #2164      +/-   ##
==========================================
+ Coverage   42.43%   42.69%   +0.26%     
==========================================
  Files         226      225       -1     
  Lines       20996    20790     -206     
==========================================
- Hits         8909     8877      -32     
+ Misses      12087    11913     -174     
Impacted Files Coverage Δ
boa_engine/src/builtins/console/mod.rs 25.64% <0.00%> (+0.21%) ⬆️
boa_engine/src/builtins/generator/mod.rs 11.11% <0.00%> (+0.24%) ⬆️
boa_engine/src/context/mod.rs 31.27% <ø> (-0.75%) ⬇️
boa_engine/src/vm/call_frame.rs 100.00% <ø> (ø)
boa_engine/src/vm/code_block.rs 41.75% <0.00%> (+3.80%) ⬆️
boa_engine/src/vm/mod.rs 49.43% <42.85%> (+1.52%) ⬆️
boa_engine/src/builtins/set/ordered_set.rs 7.40% <0.00%> (-7.41%) ⬇️
boa_engine/src/syntax/lexer/template.rs 36.95% <0.00%> (-2.63%) ⬇️
boa_engine/src/environments/runtime.rs 23.58% <0.00%> (-0.88%) ⬇️
... and 16 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cdc49e3...5e20795. Read the comment docs.

@github-actions
Copy link

github-actions bot commented Jul 5, 2022

Benchmark for 23444ad

Click to view benchmark
Test Base PR %
Arithmetic operations (Compiler) 509.8±1.71ns 523.8±0.81ns +2.75%
Arithmetic operations (Execution) 503.9±1.62ns 521.7±0.29ns +3.53%
Arithmetic operations (Parser) 6.3±0.01µs 6.3±0.03µs 0.00%
Array access (Compiler) 1525.0±3.41ns 1517.6±3.18ns -0.49%
Array access (Execution) 8.5±0.03µs 8.5±0.03µs 0.00%
Array access (Parser) 13.7±0.03µs 14.0±0.04µs +2.19%
Array creation (Compiler) 2.3±0.00µs 2.4±0.01µs +4.35%
Array creation (Execution) 2.4±0.01ms 2.5±0.00ms +4.17%
Array creation (Parser) 16.0±0.09µs 16.1±0.06µs +0.63%
Array pop (Compiler) 4.1±0.01µs 3.9±0.02µs -4.88%
Array pop (Execution) 1127.3±4.78µs 1155.8±6.15µs +2.53%
Array pop (Parser) 152.6±0.17µs 153.8±0.36µs +0.79%
Boolean Object Access (Compiler) 1158.2±2.43ns 1193.4±6.66ns +3.04%
Boolean Object Access (Execution) 4.5±0.02µs 4.6±0.01µs +2.22%
Boolean Object Access (Parser) 16.4±0.02µs 17.0±0.02µs +3.66%
Clean js (Compiler) 4.9±0.01µs 5.0±0.02µs +2.04%
Clean js (Execution) 738.8±4.23µs 753.0±6.17µs +1.92%
Clean js (Parser) 34.0±0.05µs 34.7±0.05µs +2.06%
Create Realm 238.9±2.19ns 238.9±0.20ns 0.00%
Dynamic Object Property Access (Compiler) 1834.7±6.08ns 1819.7±5.14ns -0.82%
Dynamic Object Property Access (Execution) 5.4±0.03µs 5.3±0.02µs -1.85%
Dynamic Object Property Access (Parser) 12.5±0.04µs 12.7±0.03µs +1.60%
Fibonacci (Compiler) 2.8±0.01µs 2.8±0.01µs 0.00%
Fibonacci (Execution) 1376.7±5.29µs 1386.6±5.31µs +0.72%
Fibonacci (Parser) 18.7±0.05µs 19.0±0.04µs +1.60%
For loop (Compiler) 2.7±0.01µs 2.7±0.01µs 0.00%
For loop (Execution) 16.9±0.04µs 16.9±0.07µs 0.00%
For loop (Parser) 16.2±0.03µs 16.5±0.08µs +1.85%
Mini js (Compiler) 4.4±0.01µs 4.4±0.01µs 0.00%
Mini js (Execution) 679.3±4.41µs 697.9±5.74µs +2.74%
Mini js (Parser) 29.9±0.21µs 30.6±0.20µs +2.34%
Number Object Access (Compiler) 1086.3±2.89ns 1081.6±2.86ns -0.43%
Number Object Access (Execution) 3.5±0.01µs 3.5±0.01µs 0.00%
Number Object Access (Parser) 12.8±0.02µs 13.3±0.03µs +3.91%
Object Creation (Compiler) 1601.6±5.26ns 1624.0±7.20ns +1.40%
Object Creation (Execution) 5.0±0.04µs 5.0±0.02µs 0.00%
Object Creation (Parser) 11.0±0.06µs 11.2±0.08µs +1.82%
RegExp (Compiler) 1834.1±5.31ns 1852.7±33.41ns +1.01%
RegExp (Execution) 12.3±0.07µs 12.2±0.07µs -0.81%
RegExp (Parser) 11.9±0.05µs 12.1±0.06µs +1.68%
RegExp Creation (Compiler) 1619.1±7.16ns 1617.3±7.28ns -0.11%
RegExp Creation (Execution) 9.3±0.04µs 9.1±0.03µs -2.15%
RegExp Creation (Parser) 9.9±0.02µs 10.0±0.01µs +1.01%
RegExp Literal (Compiler) 1845.8±5.08ns 1824.6±4.55ns -1.15%
RegExp Literal (Execution) 12.4±0.06µs 12.2±0.06µs -1.61%
RegExp Literal (Parser) 9.8±0.02µs 9.8±0.02µs 0.00%
RegExp Literal Creation (Compiler) 1621.5±7.21ns 1620.5±7.74ns -0.06%
RegExp Literal Creation (Execution) 9.2±0.04µs 9.1±0.04µs -1.09%
RegExp Literal Creation (Parser) 7.7±0.03µs 7.6±0.02µs -1.30%
Static Object Property Access (Compiler) 1623.7±8.58ns 1638.9±5.76ns +0.94%
Static Object Property Access (Execution) 5.3±0.05µs 5.1±0.01µs -3.77%
Static Object Property Access (Parser) 11.8±0.04µs 12.0±0.04µs +1.69%
String Object Access (Compiler) 1475.5±6.13ns 1471.4±7.80ns -0.28%
String Object Access (Execution) 6.5±0.03µs 6.4±0.02µs -1.54%
String Object Access (Parser) 16.1±0.07µs 16.8±0.13µs +4.35%
String comparison (Compiler) 2.4±0.01µs 2.4±0.01µs 0.00%
String comparison (Execution) 4.7±0.08µs 4.7±0.03µs 0.00%
String comparison (Parser) 12.6±0.03µs 12.8±0.02µs +1.59%
String concatenation (Compiler) 1807.3±3.77ns 1809.3±48.11ns +0.11%
String concatenation (Execution) 4.4±0.06µs 4.4±0.01µs 0.00%
String concatenation (Parser) 8.8±0.05µs 9.2±0.03µs +4.55%
String copy (Compiler) 1477.4±1.22ns 1492.0±3.61ns +0.99%
String copy (Execution) 4.2±0.02µs 4.1±0.01µs -2.38%
String copy (Parser) 6.7±0.01µs 6.9±0.03µs +2.99%
Symbols (Compiler) 1132.4±2.62ns 1132.8±2.89ns +0.04%
Symbols (Execution) 4.3±0.01µs 4.4±0.02µs +2.33%
Symbols (Parser) 5.2±0.01µs 5.4±0.01µs +3.85%

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.

Looks good. Makes working with frames much more straight forward.

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.

Great changes!

@Razican
Copy link
Member

Razican commented Jul 5, 2022

bors r+

bors bot pushed a commit that referenced this pull request Jul 5, 2022
This storage method should be more cache friendly since we store in contiguous memory, besides that it should make #2157 a bit easier. Will work on that next after this gets merged :)

It changes the following:
- Remove the unneeded `prev` field in `CallFrame`
- Preallocate some space for future calls (16 slots)
@bors
Copy link

bors bot commented Jul 5, 2022

Build failed:

- Remove the unneeded `prev` field in `CallFrame`
- Preallocate some space for future calls (16 slots)
- Rename Vm::frame => Vm::frames
@github-actions
Copy link

github-actions bot commented Jul 5, 2022

Benchmark for ba0aa7e

Click to view benchmark
Test Base PR %
Arithmetic operations (Compiler) 714.8±36.76ns 719.8±61.27ns +0.70%
Arithmetic operations (Execution) 747.0±74.85ns 920.3±100.01ns +23.20%
Arithmetic operations (Parser) 7.4±0.63µs 7.3±0.44µs -1.35%
Array access (Compiler) 1933.7±62.44ns 1900.5±104.62ns -1.72%
Array access (Execution) 11.0±1.23µs 10.9±0.82µs -0.91%
Array access (Parser) 16.4±1.40µs 16.2±0.89µs -1.22%
Array creation (Compiler) 3.0±0.18µs 2.8±0.14µs -6.67%
Array creation (Execution) 3.2±0.24ms 3.2±0.26ms 0.00%
Array creation (Parser) 18.7±0.92µs 18.4±0.91µs -1.60%
Array pop (Compiler) 5.1±0.25µs 5.4±0.24µs +5.88%
Array pop (Execution) 1400.3±257.21µs 1418.2±77.41µs +1.28%
Array pop (Parser) 185.1±14.51µs 187.9±12.27µs +1.51%
Boolean Object Access (Compiler) 1484.4±68.50ns 1472.8±85.22ns -0.78%
Boolean Object Access (Execution) 5.7±0.35µs 5.5±0.27µs -3.51%
Boolean Object Access (Parser) 20.0±2.02µs 19.0±0.97µs -5.00%
Clean js (Compiler) 6.2±0.28µs 6.2±0.38µs 0.00%
Clean js (Execution) 900.1±55.77µs 905.1±50.90µs +0.56%
Clean js (Parser) 41.7±3.12µs 39.5±2.14µs -5.28%
Create Realm 285.1±13.90ns 294.4±8.66ns +3.26%
Dynamic Object Property Access (Compiler) 2.4±0.17µs 2.6±0.34µs +8.33%
Dynamic Object Property Access (Execution) 7.2±0.30µs 7.3±0.35µs +1.39%
Dynamic Object Property Access (Parser) 14.9±1.50µs 14.6±0.91µs -2.01%
Fibonacci (Compiler) 3.6±0.16µs 3.6±0.22µs 0.00%
Fibonacci (Execution) 1833.8±65.92µs 1753.5±89.18µs -4.38%
Fibonacci (Parser) 22.5±1.23µs 21.9±0.86µs -2.67%
For loop (Compiler) 3.4±0.11µs 3.4±0.17µs 0.00%
For loop (Execution) 21.8±2.15µs 22.0±1.17µs +0.92%
For loop (Parser) 19.2±0.84µs 19.7±1.15µs +2.60%
Mini js (Compiler) 5.6±0.39µs 5.6±0.53µs 0.00%
Mini js (Execution) 807.2±33.61µs 823.1±37.63µs +1.97%
Mini js (Parser) 36.2±3.17µs 34.7±1.28µs -4.14%
Number Object Access (Compiler) 1457.6±154.64ns 1404.3±70.13ns -3.66%
Number Object Access (Execution) 4.3±0.14µs 4.3±0.22µs 0.00%
Number Object Access (Parser) 15.3±0.92µs 14.7±0.51µs -3.92%
Object Creation (Compiler) 2.1±0.11µs 2.0±0.11µs -4.76%
Object Creation (Execution) 6.8±0.24µs 6.8±0.42µs 0.00%
Object Creation (Parser) 12.8±0.44µs 12.7±4.21µs -0.78%
RegExp (Compiler) 2.3±0.09µs 2.3±0.15µs 0.00%
RegExp (Execution) 16.4±0.65µs 16.1±1.20µs -1.83%
RegExp (Parser) 13.7±0.52µs 13.8±1.00µs +0.73%
RegExp Creation (Compiler) 2.1±0.08µs 2.1±0.25µs 0.00%
RegExp Creation (Execution) 12.2±0.90µs 12.4±2.64µs +1.64%
RegExp Creation (Parser) 11.6±0.80µs 11.2±0.48µs -3.45%
RegExp Literal (Compiler) 2.3±0.08µs 2.3±0.10µs 0.00%
RegExp Literal (Execution) 16.2±0.88µs 16.4±1.11µs +1.23%
RegExp Literal (Parser) 11.4±0.64µs 11.0±0.53µs -3.51%
RegExp Literal Creation (Compiler) 2.1±0.09µs 2.1±0.15µs 0.00%
RegExp Literal Creation (Execution) 12.0±0.62µs 12.2±1.05µs +1.67%
RegExp Literal Creation (Parser) 8.8±0.53µs 8.6±0.41µs -2.27%
Static Object Property Access (Compiler) 2.1±0.20µs 2.1±0.12µs 0.00%
Static Object Property Access (Execution) 7.1±0.50µs 7.7±1.21µs +8.45%
Static Object Property Access (Parser) 13.7±0.68µs 13.2±0.57µs -3.65%
String Object Access (Compiler) 1863.7±71.07ns 1897.5±78.07ns +1.81%
String Object Access (Execution) 8.3±1.08µs 8.1±0.37µs -2.41%
String Object Access (Parser) 19.1±1.41µs 18.3±0.71µs -4.19%
String comparison (Compiler) 3.0±0.32µs 3.1±0.30µs +3.33%
String comparison (Execution) 6.2±0.31µs 6.2±0.25µs 0.00%
String comparison (Parser) 14.8±0.70µs 14.5±0.70µs -2.03%
String concatenation (Compiler) 2.3±0.10µs 2.3±0.20µs 0.00%
String concatenation (Execution) 6.0±0.37µs 5.9±0.42µs -1.67%
String concatenation (Parser) 10.3±0.56µs 10.0±0.38µs -2.91%
String copy (Compiler) 1902.9±76.52ns 1948.7±175.41ns +2.41%
String copy (Execution) 5.6±0.30µs 5.4±0.21µs -3.57%
String copy (Parser) 7.8±0.31µs 7.8±0.77µs 0.00%
Symbols (Compiler) 1531.7±71.66ns 1475.5±99.01ns -3.67%
Symbols (Execution) 5.7±0.17µs 5.7±0.38µs 0.00%
Symbols (Parser) 6.1±0.27µs 6.1±0.37µs 0.00%

@HalidOdat
Copy link
Member Author

bors r+

bors bot pushed a commit that referenced this pull request Jul 5, 2022
This storage method should be more cache friendly since we store in contiguous memory, besides that it should make #2157 a bit easier. Will work on that next after this gets merged :)

It changes the following:
- Remove the unneeded `prev` field in `CallFrame`
- Preallocate some space for future calls (16 slots)
@bors
Copy link

bors bot commented Jul 5, 2022

Pull request successfully merged into main.

Build succeeded:

@bors bors bot changed the title Store call frames in Vec instead of singly-linked list [Merged by Bors] - Store call frames in Vec instead of singly-linked list Jul 5, 2022
@bors bors bot closed this Jul 5, 2022
@bors bors bot deleted the vec-frames branch July 5, 2022 14:55
@raskad
Copy link
Member

raskad commented Jul 5, 2022

@HalidOdat I think you accidentally changed to an outdated version of the 262 submodule in the last push here right?

@HalidOdat
Copy link
Member Author

@HalidOdat I think you accidentally changed to an outdated version of the 262 submodule in the last push here right?

yes... I mistakingly committed it 😅 , created a PR #2166 that updates the test262 to the latest main commit

lameferret pushed a commit to lameferret/boa that referenced this pull request Jul 6, 2022
This storage method should be more cache friendly since we store in contiguous memory, besides that it should make boa-dev#2157 a bit easier. Will work on that next after this gets merged :)

It changes the following:
- Remove the unneeded `prev` field in `CallFrame`
- Preallocate some space for future calls (16 slots)
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.

3 participants