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: Skip ordinary_call_bind_this() when possible #24414

Conversation

kalenikaliaksandr
Copy link
Contributor

If during parsing it was found that function won't use this then
there is no need to initialise this_value during call.

Suite       Test                                   Speedup  Old (Mean ± Range)        New (Mean ± Range)
----------  -----------------------------------  ---------  ------------------------  ------------------------
Kraken      ai-astar.js                              1      1.855 ± 1.850 … 1.860     1.855 ± 1.840 … 1.870
Kraken      audio-beat-detection.js                  1.014  1.440 ± 1.440 … 1.440     1.420 ± 1.410 … 1.430
Kraken      audio-dft.js                             1.063  1.270 ± 1.260 … 1.280     1.195 ± 1.190 … 1.200
Kraken      audio-fft.js                             1.023  1.335 ± 1.330 … 1.340     1.305 ± 1.300 … 1.310
Kraken      audio-oscillator.js                      1.021  1.480 ± 1.480 … 1.480     1.450 ± 1.450 … 1.450
Kraken      imaging-darkroom.js                      1.02   2.535 ± 2.510 … 2.560     2.485 ± 2.480 … 2.490
Kraken      imaging-desaturate.js                    1.027  2.075 ± 2.070 … 2.080     2.020 ± 2.010 … 2.030
Kraken      imaging-gaussian-blur.js                 1.025  7.720 ± 7.710 … 7.730     7.535 ± 7.530 … 7.540
Kraken      json-parse-financial.js                  1.071  0.150 ± 0.150 … 0.150     0.140 ± 0.140 … 0.140
Kraken      json-stringify-tinderbox.js              1.042  0.250 ± 0.250 … 0.250     0.240 ± 0.240 … 0.240
Kraken      stanford-crypto-aes.js                   1.032  0.650 ± 0.650 … 0.650     0.630 ± 0.630 … 0.630
Kraken      stanford-crypto-ccm.js                   1.036  0.570 ± 0.570 … 0.570     0.550 ± 0.550 … 0.550
Kraken      stanford-crypto-pbkdf2.js                1.023  1.135 ± 1.130 … 1.140     1.110 ± 1.110 … 1.110
Kraken      stanford-crypto-sha256-iterative.js      0.989  0.460 ± 0.460 … 0.460     0.465 ± 0.460 … 0.470
Octane      box2d.js                                 1.002  2.105 ± 2.100 … 2.110     2.100 ± 2.100 … 2.100
Octane      code-load.js                             1.005  2.080 ± 2.080 … 2.080     2.070 ± 2.070 … 2.070
Octane      crypto.js                                0.973  6.100 ± 6.100 … 6.100     6.270 ± 6.200 … 6.340
Octane      deltablue.js                             0.998  2.030 ± 2.030 … 2.030     2.035 ± 2.020 … 2.050
Octane      earley-boyer.js                          1.011  17.620 ± 17.360 … 17.880  17.430 ± 17.300 … 17.560
Octane      gbemu.js                                 1.014  2.975 ± 2.970 … 2.980     2.935 ± 2.920 … 2.950
Octane      mandreel.js                              0.997  13.955 ± 13.870 … 14.040  13.995 ± 13.940 … 14.050
Octane      navier-stokes.js                         0.998  3.170 ± 3.150 … 3.190     3.175 ± 3.150 … 3.200
Octane      pdfjs.js                                 1.005  2.925 ± 2.920 … 2.930     2.910 ± 2.900 … 2.920
Octane      raytrace.js                              0.997  5.565 ± 5.530 … 5.600     5.580 ± 5.570 … 5.590
Octane      regexp.js                                0.977  22.850 ± 22.850 … 22.850  23.385 ± 23.240 … 23.530
Octane      richards.js                              0.998  2.010 ± 2.010 … 2.010     2.015 ± 2.010 … 2.020
Octane      splay.js                                 0.974  2.615 ± 2.610 … 2.620     2.685 ± 2.670 … 2.700
Octane      typescript.js                            0.991  25.975 ± 25.690 … 26.260  26.220 ± 25.990 … 26.450
Octane      zlib.js                                  1.016  73.110 ± 72.260 … 73.960  71.970 ± 71.910 … 72.030
Kraken      Total                                    1.023  22.925                    22.400
Octane      Total                                    1.002  185.085                   184.775
All Suites  Total                                    1.004  208.010                   207.175

@github-actions github-actions bot added the 👀 pr-needs-review PR needs review from a maintainer or community member label May 22, 2024
@kalenikaliaksandr kalenikaliaksandr marked this pull request as draft May 22, 2024 18:30
@github-actions github-actions bot removed the 👀 pr-needs-review PR needs review from a maintainer or community member label May 22, 2024
By using separate struct we can avoid updating AST node and
ECMAScriptFunctionObject constructors every time there is a need to
add or remove some additional information colllected during parsing.
If during parsing it was found that function won't use `this` then
there is no need to initialise `this_value` during call.
@kalenikaliaksandr kalenikaliaksandr force-pushed the avoid-calculating-this-when-possible branch from 5bc7268 to 58a44e6 Compare May 22, 2024 18:37
@kalenikaliaksandr kalenikaliaksandr marked this pull request as ready for review May 22, 2024 19:13
@github-actions github-actions bot added the 👀 pr-needs-review PR needs review from a maintainer or community member label May 22, 2024
@awesomekling awesomekling merged commit f29ac85 into SerenityOS:master May 23, 2024
13 checks passed
@github-actions github-actions bot removed the 👀 pr-needs-review PR needs review from a maintainer or community member label May 23, 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.

2 participants