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

Set-up benchmarking against other engines #1924

Closed
Razican opened this issue Mar 13, 2022 · 17 comments
Closed

Set-up benchmarking against other engines #1924

Razican opened this issue Mar 13, 2022 · 17 comments
Labels
benchmark Issues and PRs related to the benchmark subsystem. E-Easy Easy help wanted Extra attention is needed
Milestone

Comments

@Razican
Copy link
Member

Razican commented Mar 13, 2022

Currently, we run benchmarks to improve (or at least not regress) on the performance of Boa. This is a very good approach, but we are missing proper benchmarking against other JavaScript engines.

Particularly, it would be interestint to benchmark against

  • Spidermonkey
  • V8 (both in Node and in Deno)

Any other possible engine would also fit. The idea is to store these comparisons for each commit, the same way we do it for our own benchmarks. We can either create new benchmarks, or try to replicate our benchmarks in those engines, and store their values on each commit.

@Razican Razican added help wanted Extra attention is needed benchmark Issues and PRs related to the benchmark subsystem. labels Mar 13, 2022
@Razican Razican added this to the v0.15.0 milestone Mar 13, 2022
@Razican Razican changed the title Set-up benchmarking against other browsers Set-up benchmarking against other engines Mar 13, 2022
@Razican Razican modified the milestones: v0.15.0, v0.16.0 Jun 1, 2022
@jasonwilliams
Copy link
Member

Just dumping some ideas..

Hyperfine seems like it would be good for this, and maybe a separate repo under the boa-dev umbrella which can periodically run.

Something like test262 would be too much, so would need to be just a couple of JS scripts, like 3 or 4 max for now.

@MDFL64
Copy link

MDFL64 commented Jun 11, 2022

This repo is pretty old but it contains a bunch of benchmark scripts that should be usable.

@wusyong
Copy link

wusyong commented Jun 26, 2022

This repo is pretty old but it contains a bunch of benchmark scripts that should be usable.

quickJS benchmark with v8-v7. Maybe we can see some results between boa, quickJS, and v8.

@wusyong
Copy link

wusyong commented Jun 27, 2022

I just modify the benchmark above so it can work with boa. Here's the result from @CYBAI
https://gist.github.com/wusyong/bae2a336ee22885c4e1eed02d748f118

Richards: 8.64
DeltaBlue: 7.19
RayTrace: 30.0
----
Score (version 7): 12.3

And here's V8's:

Richards: 26212
DeltaBlue: 60518
RayTrace: 65267
----
Score (version 7): 46956

I haven't tested the rest because some of them will stuck.

@jasonwilliams
Copy link
Member

Hey @wusyong great work on this, I had some questions.
Are there any current benchmarks the engines are being judged by today that Boa can be added to or is this the best option?
What does those numbers mean and are those names [Richards] just some test cases?
What does the score mean?

@wusyong
Copy link

wusyong commented Jun 28, 2022

I don't this is the best benchmark tbh. This benchmark has been archived by mozilla.
I think QuickJS choose this just for quick result. It doesn't provide metrics to keep monitor ever since.
But V8 results from @CYBAI is similar to QuickJS posted.
We can get some idea about the gaps between those engines.

@gkorland
Copy link

gkorland commented Dec 13, 2022

@jasonwilliams @wusyong I think that if boa is around these numbers

Richards: 8.64
DeltaBlue: 7.19
RayTrace: 30.0
----
Score (version 7): 12.3

Then there is still a long way to go here compared to the numbers QuickJS published
image

@lastmjs
Copy link
Contributor

lastmjs commented Feb 20, 2023

I posted this in the Discord on November 11, 2022, I think it will be useful for this issue:

I just finished independently running the benchmarks myself, let me share the numbers now. It does look like there's a 25-30x hit in performance if you compare Boa to QuickJS.

Here's QuickJS and various other engines compared with each other: https://bellard.org/quickjs/bench.html

Boa V8 benchmark results:

PROGRESS Richards
RESULT Richards 23.0
PROGRESS DeltaBlue
RESULT DeltaBlue 21.6
PROGRESS Encrypt
PROGRESS Decrypt
RESULT Crypto 32.9
PROGRESS RayTrace
RESULT RayTrace 88.1
PROGRESS Earley
PROGRESS Boyer
RESULT EarleyBoyer 95.3
ERROR RegExp TypeError: not a constructor
undefined
PROGRESS RegExp
PROGRESS Splay
RESULT Splay 114
PROGRESS NavierStokes
RESULT NavierStokes 8.05
SCORE 38.5
Uncaught Error: Benchmark had 1 errors

QuickJS V8 benchmark results:

PROGRESS Richards
RESULT Richards 799
PROGRESS DeltaBlue
RESULT DeltaBlue 789
PROGRESS Encrypt
PROGRESS Decrypt
RESULT Crypto 964
PROGRESS RayTrace
RESULT RayTrace 1065
PROGRESS Earley
PROGRESS Boyer
RESULT EarleyBoyer 1480
PROGRESS RegExp
RESULT RegExp 265
PROGRESS Splay
RESULT Splay 2023
PROGRESS NavierStokes
RESULT NavierStokes 1911
SCORE 998

It's very easy to run the benchmarks.

You need this archive: https://bellard.org/quickjs/quickjs-extras-2021-03-27.tar.xz

To run quickjs V8 benchmarks: Check out their github repo and copy the bench-v8 from the archive to tests/bench-v8 and run make bench-v8

To run boa V8 benchmarks: Check out the github repo, build using cargo build --release --bin boa, then call boa on the combined.js from the quickjs archive

@jasonwilliams
Copy link
Member

Thanks for this @lastmjs its quite informative. So I think we need to do a few things here:

  • It would be good to have some benchmarking framework that builds on this, something we could run on CI maybe.
  • We’re aware we’re slower than other engines, we lack inline caching, hidden classes, and a Just In Time compiler, plus various other things. We should start tracking the progress of these more closely. Maybe even set up a project to group these by.

Let me know if there’s any of these you’d like to collaborate on it any.

I understand how important performance is and we’ll hopefully chat about it when we’re next together.

@lastmjs
Copy link
Contributor

lastmjs commented Feb 22, 2023

I can setup the benchmarking CI using the benchmarking framework I shared if that's what we'd like to do. It should be relatively simple and would at least get us started with measuring.

Also, for my company's purposes we really need optimizations besides JIT because we're executing in a Wasm runtime. There should be ~30x improvement without JIT.

@jasonwilliams
Copy link
Member

@lastmjs it would be good to see https://github.com/GoogleChromeLabs/jsvu be used so we can test against engines other than quickjs

here is an example https://github.com/mathiasbynens/string-prototype-replace-regexp-benchmark/blob/main/bench.sh

would be good to see something like hyperfine used too

@lastmjs
Copy link
Contributor

lastmjs commented Feb 23, 2023

I'm suggesting using the V8 benchmarks, are you suggesting combining those benchmarks with jsvu so that we run the benchmarks against various engines in CI? Or are you suggesting another benchmarking framework be used?

The simplest thing to start with would be getting the V8 benchmarks to run in CI, so we can compare against this chart: https://bellard.org/quickjs/bench.html

@jasonwilliams
Copy link
Member

are you suggesting combining those benchmarks with jsvu so that we run the benchmarks against various engines in CI?

Yes I'm suggesting this.
Do you have a link to the V8 benchmarks?

@lastmjs
Copy link
Contributor

lastmjs commented Feb 23, 2023

This is all done with the V8 benchmarks: https://bellard.org/quickjs/bench.html

Everything I have shared so far has been using the V8 benchmarks.

@jasonwilliams
Copy link
Member

jasonwilliams commented Mar 29, 2024

In order for us to keep on track with making sure we're focusing on performance i propose we retire the current benchmarks we have and migrate to the V8 benchmarks quickjs were using. Funnily enough quickJS have moved away from that benchmark suite now to something they have built-in but I still think it should make for a better benchmark that we have today.

The current suite is no longer useful or serving its purpose, it was created a long time ago and there have been so many optimizations since then that the numbers on the graphs are so out of magnitude you can't make use of it today. Also the things we were benchmarking or checking have either changed or we've refactored so we (the maintainers) don't look at that page too often. Although the v8 benches are no longer used by V8 themselves they will still serve a useful purpose for us at least until we reach a point where we're much closer to the other engines.

I would propose us having a nightly job which can take the bench-v8 from the archive like @lastmjs showed and run the latest boa vs other engines from esvu or eshost then print the results into a JSON file on the data repo. The website can take that data and generate some graphs with it.

We can start of with this job running as a Github action, but if its too noisy we can move it to a dedicated server.

Engines

Duktape

Navigating to https://github.com/svaarala/duktape/releases/tag/v2.7.0 and download duktape-2.7.0.tar.xz

  • tar xvfJ duktape-2.7.0.tar.xz
  • make -f Makefile.cmdline
  • ./duk combined.js

JerryScript

Needs to be built from source https://github.com/jerryscript-project/jerryscript?tab=readme-ov-file

QuickJS

esvu

V8

esvu

SpiderMonkey

esvu

Kiesel

https://files.kiesel.dev

more info: https://blog.chromium.org/2010/10/v8-benchmark-suite-updated.html?m=1

@jasonwilliams jasonwilliams modified the milestones: v0.18.0, v0.19.0 Mar 29, 2024
@jasonwilliams jasonwilliams added the E-Easy Easy label Mar 29, 2024
@jasonwilliams
Copy link
Member

We have new benchmarks https://boajs.dev/benchmarks

@jedel1043
Copy link
Member

Closing by the previous comment.

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. E-Easy Easy help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

7 participants