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

LibJS: Another day, another pack of optimizations #24324

Conversation

awesomekling
Copy link
Member

More work towards going fast. See individual commits.

Benchmarks move in the right direction :^)

Suite       Test                                   Speedup  Old (Mean ± Range)        New (Mean ± Range)
----------  -----------------------------------  ---------  ------------------------  ------------------------
Kraken      ai-astar.js                              1.053  2.575 ± 2.570 … 2.580     2.445 ± 2.430 … 2.460
Kraken      audio-beat-detection.js                  1.017  1.455 ± 1.440 … 1.470     1.430 ± 1.430 … 1.430
Kraken      audio-dft.js                             1.034  1.225 ± 1.210 … 1.240     1.185 ± 1.170 … 1.200
Kraken      audio-fft.js                             0.975  1.355 ± 1.350 … 1.360     1.390 ± 1.390 … 1.390
Kraken      audio-oscillator.js                      0.935  1.440 ± 1.440 … 1.440     1.540 ± 1.540 … 1.540
Kraken      imaging-darkroom.js                      0.927  1.830 ± 1.810 … 1.850     1.975 ± 1.960 … 1.990
Kraken      imaging-desaturate.js                    1.224  2.760 ± 2.750 … 2.770     2.255 ± 2.240 … 2.270
Kraken      imaging-gaussian-blur.js                 0.998  7.785 ± 7.780 … 7.790     7.800 ± 7.740 … 7.860
Kraken      json-parse-financial.js                  1      0.125 ± 0.120 … 0.130     0.125 ± 0.120 … 0.130
Kraken      json-stringify-tinderbox.js              0.96   0.240 ± 0.240 … 0.240     0.250 ± 0.250 … 0.250
Kraken      stanford-crypto-aes.js                   1.015  0.685 ± 0.670 … 0.700     0.675 ± 0.660 … 0.690
Kraken      stanford-crypto-ccm.js                   0.957  0.555 ± 0.550 … 0.560     0.580 ± 0.580 … 0.580
Kraken      stanford-crypto-pbkdf2.js                0.977  1.055 ± 1.050 … 1.060     1.080 ± 1.080 … 1.080
Kraken      stanford-crypto-sha256-iterative.js      0.989  0.435 ± 0.430 … 0.440     0.440 ± 0.430 … 0.450
Octane      box2d.js                                 1.011  2.320 ± 2.310 … 2.330     2.295 ± 2.250 … 2.340
Octane      code-load.js                             0.993  2.150 ± 2.150 … 2.150     2.165 ± 2.160 … 2.170
Octane      crypto.js                                1.033  7.370 ± 7.280 … 7.460     7.135 ± 7.110 … 7.160
Octane      deltablue.js                             0.995  2.015 ± 2.010 … 2.020     2.025 ± 2.010 … 2.040
Octane      earley-boyer.js                          1.004  16.925 ± 16.810 … 17.040  16.855 ± 16.780 … 16.930
Octane      gbemu.js                                 0.995  2.885 ± 2.870 … 2.900     2.900 ± 2.890 … 2.910
Octane      mandreel.js                              0.999  13.160 ± 12.950 … 13.370  13.175 ± 13.130 … 13.220
Octane      navier-stokes.js                         1.037  3.190 ± 3.170 … 3.210     3.075 ± 3.070 … 3.080
Octane      pdfjs.js                                 1.002  2.845 ± 2.830 … 2.860     2.840 ± 2.810 … 2.870
Octane      raytrace.js                              1.019  6.880 ± 6.860 … 6.900     6.755 ± 6.720 … 6.790
Octane      regexp.js                                0.981  22.270 ± 22.050 … 22.490  22.705 ± 22.270 … 23.140
Octane      richards.js                              1      2.015 ± 2.010 … 2.020     2.015 ± 2.010 … 2.020
Octane      splay.js                                 0.988  2.935 ± 2.920 … 2.950     2.970 ± 2.970 … 2.970
Octane      typescript.js                            0.995  36.045 ± 35.720 … 36.370  36.215 ± 36.060 … 36.370
Octane      zlib.js                                  1.062  81.165 ± 79.820 … 82.510  76.395 ± 74.860 … 77.930
Kraken      Total                                    1.015  23.520                    23.170
Octane      Total                                    1.023  204.170                   199.520
All Suites  Total                                    1.022  227.690                   222.690

The last completion value in a function is not exposed to the language,
since functions always either return something, or undefined.

Given this, we can avoid emitting code that propagates the completion
value from various statements, as long as we know we're generating code
for a context where the completion value is not accessible. In practical
terms, this means that function code gets to do less completion
shuffling, while global and eval code has to keep doing it.
@github-actions github-actions bot added the 👀 pr-needs-review PR needs review from a maintainer or community member label May 14, 2024
Instead of SetVariable having 2x2 modes for variable/lexical and
initialize/set, those 4 modes are now separate instructions, which
makes each instruction much less branchy.
There are no calls to these anywhere anymore.
@awesomekling awesomekling force-pushed the another_day_another_js_optimization_pack branch from e7223db to ef6a600 Compare May 14, 2024 11:50
@awesomekling awesomekling merged commit ce7c925 into SerenityOS:master May 14, 2024
11 checks passed
@github-actions github-actions bot removed the 👀 pr-needs-review PR needs review from a maintainer or community member label May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant