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

Added benchmarks for full program execution #560

Merged
merged 2 commits into from
Jul 10, 2020
Merged

Conversation

Razican
Copy link
Member

@Razican Razican commented Jul 10, 2020

This adds benchmarks for full program execution.

Sometimes we have benchmarks that tell us things like "the parser is now 50% slower", but what does that mean for the whole program execution? Maybe it's just a 1% speed reduction.

Also, we have no benchmarks to check improvements if for example, we create the realm in a new thread in parallel to lexing + parsing. This should reduce at least a bit the full program execution time, but there is no way to measure it.

With this PR, all execution benchmarks get duplicated by using our exec() function, that creates a realm, lexes and parses and finally executes everything. This should give us insights on how each change affects to a full workflow.

I also took the opportunity to remove some non-needed black boxes from old benchmarks. They were just preventing optimizations in pre-benchmark code, so they were not useful.

Ideally, this should land before #486/#559 in order to see the change in that PR.

@Razican Razican added enhancement New feature or request benchmark Issues and PRs related to the benchmark subsystem. labels Jul 10, 2020
@Razican Razican added this to the v0.10.0 milestone Jul 10, 2020
@codecov
Copy link

codecov bot commented Jul 10, 2020

Codecov Report

Merging #560 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #560   +/-   ##
=======================================
  Coverage   68.19%   68.19%           
=======================================
  Files         172      172           
  Lines       10573    10573           
=======================================
  Hits         7210     7210           
  Misses       3363     3363           

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 8b3d52b...5646d21. Read the comment docs.

@Lan2u
Copy link

Lan2u commented Jul 10, 2020

Is it potentially also worth adding some more examples of 'less abstract' javascript?

@github-actions
Copy link

Benchmark for 84a457a

Click to view benchmark
Test PR Benchmark Master Benchmark %
Arithmetic operations (Execution) 440.3±33.57ns 514.5±30.52ns -14.42%
Arithmetic operations (Full) 188.1±9.11µs N/A N/A
Array access (Execution) 15.3±0.81µs 16.2±1.02µs -5.56%
Array access (Full) 213.6±9.02µs N/A N/A
Array creation (Execution) 4.0±0.13ms 4.3±0.18ms -6.98%
Array creation (Full) 4.5±0.15ms N/A N/A
Array pop (Execution) 1514.4±64.51µs 1667.7±1001.09µs -9.19%
Array pop (Full) 1911.0±114.57µs N/A N/A
Boolean Object Access (Execution) 6.1±0.38µs 6.0±0.36µs +1.67%
Boolean Object Access (Full) 200.6±12.15µs N/A N/A
Create Realm 168.9±10.99µs 175.0±11.32µs -3.49%
Dynamic Object Property Access (Execution) 8.1±0.49µs 8.2±0.53µs -1.22%
Dynamic Object Property Access (Full) 203.0±8.80µs N/A N/A
Expression (Lexer) 2.3±0.14µs 2.4±0.12µs -4.17%
Expression (Parser) 5.4±0.37µs 5.6±0.29µs -3.57%
Fibonacci (Execution) 1213.5±49.36µs 1319.8±125.56µs -8.05%
Fibonacci (Full) 1390.3±72.11µs N/A N/A
For loop (Execution) 26.8±1.38µs 28.6±2.34µs -6.29%
For loop (Full) 219.6±10.78µs N/A N/A
For loop (Lexer) 6.0±0.36µs 5.9±0.26µs +1.69%
For loop (Parser) 15.6±0.61µs 15.5±0.79µs +0.65%
Goal Symbols (Parser) 9.6±0.36µs 9.7±0.55µs -1.03%
Hello World (Lexer) 1060.1±127.68ns 1046.9±35.47ns +1.26%
Hello World (Parser) 2.4±0.10µs 2.6±0.19µs -7.69%
Long file (Parser) 7.0±0.19ms 7.1±0.33ms -1.41%
Number Object Access (Execution) 4.7±0.23µs 4.9±0.30µs -4.08%
Number Object Access (Full) 244.4±10.60µs N/A N/A
Object Creation (Execution) 7.1±0.26µs 7.3±0.73µs -2.74%
Object Creation (Full) 224.8±16.39µs N/A N/A
RegExp (Execution) 85.8±4.66µs 87.4±6.27µs -1.83%
RegExp (Full) 344.5±15.72µs N/A N/A
RegExp Literal (Execution) 91.1±6.97µs 92.5±6.05µs -1.51%
RegExp Literal (Full) 295.7±12.08µs N/A N/A
RegExp Literal Creation (Execution) 85.0±4.20µs 86.9±4.50µs -2.19%
RegExp Literal Creation (Full) 345.0±15.20µs N/A N/A
Static Object Property Access (Execution) 7.4±0.38µs 7.6±0.52µs -2.63%
Static Object Property Access (Full) 200.7±11.28µs N/A N/A
String Object Access (Execution) 10.2±0.56µs 10.3±0.51µs -0.97%
String Object Access (Full) 203.1±10.14µs N/A N/A
String comparison (Execution) 7.9±0.45µs 8.4±0.31µs -5.95%
String comparison (Full) 212.8±16.13µs N/A N/A
String concatenation (Execution) 6.6±0.29µs 7.0±0.84µs -5.71%
String concatenation (Full) 197.3±15.18µs N/A N/A
String copy (Execution) 5.3±0.29µs 5.9±0.41µs -10.17%
String copy (Full) 190.6±6.08µs N/A N/A
Symbols (Execution) 4.7±0.23µs 5.0±0.36µs -6.00%
Symbols (Full) 190.7±10.82µs N/A N/A

@HalidOdat HalidOdat merged commit 6a721f9 into master Jul 10, 2020
@HalidOdat HalidOdat deleted the full_program_bench branch July 10, 2020 15:03
@Razican
Copy link
Member Author

Razican commented Jul 10, 2020

Is it potentially also worth adding some more examples of 'less abstract' javascript?

What do you mean? If you find interesting stuff to benchmark, feel free to add it :)

@Lan2u
Copy link

Lan2u commented Jul 10, 2020

Is it potentially also worth adding some more examples of 'less abstract' javascript?

What do you mean? If you find interesting stuff to benchmark, feel free to add it :)

I'll see if I can find some good examples

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
benchmark Issues and PRs related to the benchmark subsystem. enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants