Skip to content

Conversation

@awesomekling
Copy link
Member

Big pile of small things to reduce JS call overhead and make calls go faster!

Suite       Test                                      Speedup  Old (Mean ± Range)                 New (Mean ± Range)
----------  --------------------------------------  ---------  ---------------------------------  ---------------------------------
SunSpider   3d-cube.js                                  0.978  0.016 ± 0.016 … 0.017              0.017 ± 0.017 … 0.017
SunSpider   3d-morph.js                                 0.98   0.020 ± 0.020 … 0.020              0.020 ± 0.020 … 0.021
SunSpider   3d-raytrace.js                              0.987  0.020 ± 0.020 … 0.020              0.020 ± 0.020 … 0.020
SunSpider   access-binary-trees.js                      0.951  0.012 ± 0.012 … 0.012              0.013 ± 0.013 … 0.013
SunSpider   access-fannkuch.js                          1.008  0.034 ± 0.033 … 0.034              0.033 ± 0.033 … 0.034
SunSpider   access-nbody.js                             0.988  0.021 ± 0.021 … 0.021              0.021 ± 0.021 … 0.021
SunSpider   access-nsieve.js                            0.927  0.012 ± 0.012 … 0.012              0.013 ± 0.013 … 0.014
SunSpider   bitops-3bit-bits-in-byte.js                 0.941  0.012 ± 0.012 … 0.012              0.013 ± 0.012 … 0.014
SunSpider   bitops-bits-in-byte.js                      0.926  0.017 ± 0.016 … 0.017              0.018 ± 0.018 … 0.018
SunSpider   bitops-bitwise-and.js                       0.938  0.018 ± 0.018 … 0.018              0.019 ± 0.019 … 0.019
SunSpider   bitops-nsieve-bits.js                       0.931  0.018 ± 0.018 … 0.018              0.019 ± 0.019 … 0.019
SunSpider   controlflow-recursive.js                    0.983  0.013 ± 0.013 … 0.013              0.013 ± 0.012 … 0.013
SunSpider   crypto-aes.js                               0.989  0.019 ± 0.019 … 0.019              0.019 ± 0.019 … 0.020
SunSpider   crypto-md5.js                               0.967  0.012 ± 0.012 … 0.012              0.013 ± 0.013 … 0.013
SunSpider   crypto-sha1.js                              0.973  0.012 ± 0.012 … 0.012              0.012 ± 0.012 … 0.013
SunSpider   date-format-tofte.js                        0.976  0.039 ± 0.039 … 0.039              0.040 ± 0.039 … 0.040
SunSpider   date-format-xparb.js                        0.982  0.035 ± 0.035 … 0.035              0.035 ± 0.035 … 0.035
SunSpider   math-cordic.js                              0.953  0.021 ± 0.021 … 0.021              0.022 ± 0.022 … 0.023
SunSpider   math-partial-sums.js                        0.961  0.014 ± 0.014 … 0.014              0.015 ± 0.014 … 0.015
SunSpider   math-spectral-norm.js                       0.98   0.013 ± 0.013 … 0.013              0.013 ± 0.013 … 0.014
SunSpider   regexp-dna.js                               0.998  0.260 ± 0.258 … 0.261              0.260 ± 0.258 … 0.262
SunSpider   string-base64.js                            1.029  0.017 ± 0.017 … 0.017              0.016 ± 0.016 … 0.017
SunSpider   string-fasta.js                             0.975  0.052 ± 0.052 … 0.052              0.053 ± 0.053 … 0.054
SunSpider   string-tagcloud.js                          0.988  0.074 ± 0.073 … 0.074              0.075 ± 0.075 … 0.075
SunSpider   string-unpack-code.js                       0.986  0.079 ± 0.079 … 0.079              0.080 ± 0.080 … 0.081
SunSpider   string-validate-input.js                    0.979  0.032 ± 0.032 … 0.033              0.033 ± 0.033 … 0.033
Kraken      ai-astar.js                                 1.025  1.176 ± 1.164 … 1.188              1.148 ± 1.143 … 1.152
Kraken      audio-beat-detection.js                     1.151  0.979 ± 0.976 … 0.982              0.850 ± 0.849 … 0.852
Kraken      audio-dft.js                                1.01   0.596 ± 0.596 … 0.596              0.590 ± 0.589 … 0.591
Kraken      audio-fft.js                                1.037  0.767 ± 0.765 … 0.769              0.740 ± 0.738 … 0.742
Kraken      audio-oscillator.js                         1.008  0.745 ± 0.743 … 0.746              0.738 ± 0.738 … 0.738
Kraken      imaging-darkroom.js                         0.982  1.022 ± 1.018 … 1.026              1.040 ± 1.040 … 1.040
Kraken      imaging-desaturate.js                       1.04   1.362 ± 1.356 … 1.368              1.310 ± 1.310 … 1.310
Kraken      imaging-gaussian-blur.js                    1.032  5.555 ± 5.551 … 5.559              5.385 ± 5.384 … 5.386
Kraken      json-parse-financial.js                     0.978  0.070 ± 0.070 … 0.071              0.072 ± 0.071 … 0.073
Kraken      json-stringify-tinderbox.js                 0.993  0.082 ± 0.080 … 0.083              0.082 ± 0.082 … 0.082
Kraken      stanford-crypto-aes.js                      1.036  0.366 ± 0.364 … 0.367              0.353 ± 0.352 … 0.354
Kraken      stanford-crypto-ccm.js                      1.031  0.319 ± 0.319 … 0.320              0.309 ± 0.309 … 0.310
Kraken      stanford-crypto-pbkdf2.js                   1.041  0.599 ± 0.598 … 0.600              0.575 ± 0.575 … 0.575
Kraken      stanford-crypto-sha256-iterative.js         1.029  0.219 ± 0.219 … 0.219              0.213 ± 0.213 … 0.213
Octane      box2d.js                                    1.036  5051.000 ± 5044.000 … 5058.000     5231.500 ± 5224.000 … 5239.000
Octane      code-load.js                                1.003  13385.000 ± 13382.000 … 13388.000  13429.000 ± 13424.000 … 13434.000
Octane      crypto.js                                   1.034  1695.500 ± 1694.000 … 1697.000     1753.000 ± 1752.000 … 1754.000
Octane      deltablue.js                                1.061  1074.000 ± 1068.000 … 1080.000     1140.000 ± 1136.000 … 1144.000
Octane      earley-boyer.js                             1.008  3024.500 ± 2971.000 … 3078.000     3049.000 ± 3049.000 … 3049.000
Octane      gbemu.js                                    1.014  9351.000 ± 9347.000 … 9355.000     9482.000 ± 9456.000 … 9508.000
Octane      mandreel.js                                 1.007  8165.500 ± 8159.000 … 8172.000     8226.000 ± 8226.000 … 8226.000
Octane      navier-stokes.js                            1.027  2393.500 ± 2391.000 … 2396.000     2459.000 ± 2454.000 … 2464.000
Octane      pdfjs.js                                    1.02   5161.500 ± 5153.000 … 5170.000     5266.500 ± 5264.000 … 5269.000
Octane      raytrace.js                                 1.024  2011.000 ± 2002.000 … 2020.000     2060.000 ± 2059.000 … 2061.000
Octane      regexp.js                                   1.007  142.000 ± 142.000 … 142.000        143.000 ± 143.000 … 143.000
Octane      richards.js                                 1.019  1183.000 ± 1181.000 … 1185.000     1205.000 ± 1205.000 … 1205.000
Octane      splay.js                                    0.992  4839.000 ± 4825.000 … 4853.000     4802.000 ± 4770.000 … 4834.000
Octane      typescript.js                               1.024  12909.500 ± 12902.000 … 12917.000  13213.000 ± 13098.000 … 13328.000
Octane      zlib.js                                     1.005  2677.500 ± 2677.000 … 2678.000     2691.500 ± 2690.000 … 2693.000
JetStream   bigfib.cpp.js                               0.996  10.319 ± 10.316 … 10.323           10.356 ± 10.355 … 10.358
JetStream   cdjs.js                                     1.015  3.726 ± 3.722 … 3.729              3.672 ± 3.659 … 3.684
JetStream   container.cpp.js                            1.035  38.280 ± 38.240 … 38.320           36.993 ± 36.892 … 37.093
JetStream   dry.c.js                                    0.988  22.067 ± 22.045 … 22.089           22.346 ± 22.316 … 22.376
JetStream   float-mm.c.js                               0.997  24.416 ± 24.239 … 24.592           24.486 ± 24.444 … 24.527
JetStream   gcc-loops.cpp.js                            1.006  149.296 ± 149.251 … 149.341        148.430 ± 148.133 … 148.727
JetStream   hash-map.js                                 1.04   1.444 ± 1.441 … 1.446              1.389 ± 1.385 … 1.392
JetStream   n-body.c.js                                 1.008  34.682 ± 34.658 … 34.705           34.397 ± 34.387 … 34.406
JetStream   quicksort.c.js                              1.016  6.026 ± 6.020 … 6.032              5.931 ± 5.923 … 5.940
JetStream   towers.c.js                                 1.034  6.781 ± 6.776 … 6.786              6.560 ± 6.559 … 6.560
JetStream3  js-tokens.js                                0.987  0.684 ± 0.683 … 0.686              0.693 ± 0.692 … 0.694
JetStream3  lazy-collections.js                         1.022  1.204 ± 1.202 … 1.206              1.178 ± 1.177 … 1.180
JetStream3  raytrace-private-class-fields.js            1.019  4.412 ± 4.398 … 4.425              4.328 ± 4.306 … 4.350
JetStream3  raytrace-public-class-fields.js             1.027  3.416 ± 3.388 … 3.444              3.326 ± 3.303 … 3.349
JetStream3  sync-file-system.js                         1.028  2.013 ± 2.013 … 2.013              1.958 ± 1.951 … 1.965
MicroBench  array-destructuring-assignment-rest.js      0.981  0.382 ± 0.380 … 0.385              0.389 ± 0.387 … 0.392
MicroBench  array-destructuring-assignment.js           1.036  2.734 ± 2.598 … 2.869              2.640 ± 2.632 … 2.647
MicroBench  array-prototype-map.js                      1.062  1.146 ± 1.142 … 1.151              1.079 ± 1.076 … 1.083
MicroBench  array-prototype-shift.js                    0.974  0.010 ± 0.009 … 0.010              0.010 ± 0.009 … 0.011
MicroBench  bound-call-00-args.js                       1.135  1.310 ± 1.305 … 1.316              1.154 ± 1.152 … 1.156
MicroBench  bound-call-04-args.js                       1.079  1.438 ± 1.432 … 1.445              1.333 ± 1.333 … 1.333
MicroBench  bound-call-16-args.js                       1.097  1.639 ± 1.639 … 1.640              1.494 ± 1.487 … 1.501
MicroBench  call-00-args.js                             1.083  1.142 ± 1.136 … 1.148              1.054 ± 1.007 … 1.101
MicroBench  call-01-args.js                             1.094  1.166 ± 1.162 … 1.171              1.067 ± 1.057 … 1.076
MicroBench  call-02-args.js                             1.111  1.190 ± 1.188 … 1.193              1.072 ± 1.062 … 1.081
MicroBench  call-03-args.js                             1.107  1.216 ± 1.180 … 1.252              1.098 ± 1.095 … 1.101
MicroBench  call-04-args.js                             1.099  1.229 ± 1.208 … 1.250              1.118 ± 1.116 … 1.120
MicroBench  call-16-args.js                             1.011  1.466 ± 1.465 … 1.467              1.450 ± 1.448 … 1.452
MicroBench  call-32-args.js                             0.958  1.791 ± 1.783 … 1.800              1.869 ± 1.869 … 1.869
MicroBench  for-in-indexed-properties.js                1.005  0.954 ± 0.954 … 0.955              0.950 ± 0.948 … 0.951
MicroBench  for-in-named-properties.js                  0.982  1.432 ± 1.431 … 1.432              1.458 ± 1.457 … 1.460
MicroBench  for-of.js                                   1.011  0.434 ± 0.434 … 0.434              0.429 ± 0.428 … 0.430
MicroBench  object-keys.js                              1.008  1.733 ± 1.732 … 1.734              1.720 ± 1.719 … 1.720
MicroBench  object-set-with-rope-strings.js             1.001  0.619 ± 0.617 … 0.621              0.618 ± 0.617 … 0.619
MicroBench  pic-add-own.js                              1.083  0.798 ± 0.784 … 0.812              0.737 ± 0.736 … 0.738
MicroBench  pic-get-own.js                              1.062  1.189 ± 1.169 … 1.209              1.119 ± 1.103 … 1.136
MicroBench  pic-get-pchain.js                           1.033  1.193 ± 1.173 … 1.214              1.155 ± 1.153 … 1.157
MicroBench  pic-put-own.js                              1.124  1.281 ± 1.263 … 1.299              1.140 ± 1.140 … 1.141
MicroBench  pic-put-pchain.js                           1.085  2.452 ± 2.383 … 2.520              2.260 ± 2.219 … 2.301
MicroBench  setter-in-prototype-chain.js                0.952  1.878 ± 1.869 … 1.886              1.972 ± 1.944 … 1.999
MicroBench  strictly-equals-object.js                   0.984  1.420 ± 1.419 … 1.421              1.442 ± 1.442 … 1.443
SunSpider   Total                                       0.982  0.891                              0.907
Kraken      Total                                       1.034  13.855                             13.405
Octane      Total                                       1.015  73063.500                          74150.500
JetStream   Total                                       1.008  297.036                            294.558
JetStream3  Total                                       1.021  11.729                             11.483
MicroBench  Total                                       1.045  33.244                             31.827
All Suites  Total                                       1.014  472.524                            466.090

@Hendiadyoin1
Copy link
Contributor

Great work,
good that I did not start rebasing my interpreter PR again, yet

This gets rid of a RefPtr in ExecutionContext, bringing us one step
closer to destructor-less ExecutionContext.
This makes ExecutionContext trivially destructible, which means less
work to do on function exit.
This means we don't have to do a bunch of math to find the next
instruction boundary, and gives us a small speedup.
There's only ever one GC::Heap per process, so let's have a way to find
it even when you have no context.
This is only used by ExecutionContexts owned by an HTML::ESO.
Instead of using this span, we can just use the getter that calculates
the base of the register/constant/local/argument array based on the
ExecutionContext's own address.
Instead of always checking if we're about to return an empty completion
value in Interpreter::run_executable(), we now coerce empty completions
to the undefined value earlier instead.

This simplifies the most common path through run_executable(), giving us
a small speedup.
We were already skipping the bounds checks on this thing anyway,
so might as well shrink ExecutionContext by 8 bytes by doing this.
@awesomekling awesomekling merged commit 5563643 into LadybirdBrowser:master Nov 1, 2025
10 checks passed
@awesomekling awesomekling deleted the go-faster-calls-go branch November 1, 2025 07:40
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