Skip to content

Instantly share code, notes, and snippets.

@billywhizz
Created February 18, 2024 19:02
Show Gist options
  • Save billywhizz/33d3d8a1fa60d7b0c3f072d6e439951c to your computer and use it in GitHub Desktop.
Save billywhizz/33d3d8a1fa60d7b0c3f072d6e439951c to your computer and use it in GitHub Desktop.
JS runtime hello world benches

run

sudo nice -n 20 taskset --cpu-list 7 ./x86_64-linux-poop "/bin/true" "/usr/local/bin/luajit-2.1.0-beta3 hello.lua" "./qjs-linux-x86_64 hello.js" "./llrt hello.js" "./hermes hello2.js" "./lo_static" "./lo hello.js" "/home/andrew/.bun/bin/bun hello.js" "/home/andrew/.node/20/bin/node hello.js" "/home/andrew/.deno/bin/deno run hello.js"

results

Benchmark 1 (8786 runs): /bin/true
  measurement          mean ± σ            min … max           outliers         delta
  wall_time           528us ± 98.3us     483us … 1.82ms       1632 (19%)        0%
  peak_rss           1.18MB ±    0      1.18MB … 1.18MB          0 ( 0%)        0%
  cpu_cycles          195K  ± 25.4K      181K  …  559K        1392 (16%)        0%
  instructions        144K  ± 1.89       144K  …  144K         100 ( 1%)        0%
  cache_references   12.3K  ±  372      11.1K  … 15.8K         393 ( 4%)        0%
  cache_misses        468   ± 1.10K        5   … 8.96K        1276 (15%)        0%
  branch_misses      1.64K  ± 44.4      1.43K  … 2.01K         121 ( 1%)        0%
Benchmark 2 (5581 runs): /usr/local/bin/luajit-2.1.0-beta3 hello.lua
  measurement          mean ± σ            min … max           outliers         delta
  wall_time           856us ±  108us     788us … 2.25ms        976 (17%)        💩+ 62.3% ±  0.6%
  peak_rss           2.46MB ± 57.8KB    2.36MB … 2.49MB          0 ( 0%)        💩+108.2% ±  0.1%
  cpu_cycles          529K  ± 50.5K      500K  … 1.08M         814 (15%)        💩+170.9% ±  0.6%
  instructions        494K  ±  479       492K  …  496K          42 ( 1%)        💩+242.8% ±  0.0%
  cache_references   27.3K  ±  569      25.6K  … 36.4K         168 ( 3%)        💩+121.2% ±  0.1%
  cache_misses       1.63K  ± 2.74K      154   … 18.2K         757 (14%)        💩+248.8% ± 13.7%
  branch_misses      5.87K  ±  109      5.60K  … 7.97K          57 ( 1%)        💩+257.8% ±  0.2%
Benchmark 3 (4134 runs): ./qjs-linux-x86_64 hello.js
  measurement          mean ± σ            min … max           outliers         delta
  wall_time          1.17ms ±  203us    1.05ms … 2.65ms        858 (21%)        💩+121.4% ±  1.0%
  peak_rss           1.05MB ±    0      1.05MB … 1.05MB          0 ( 0%)        ⚡- 11.1% ±  0.0%
  cpu_cycles         1.42M  ±  204K     1.34M  … 2.52M         712 (17%)        💩+629.5% ±  2.2%
  instructions       1.88M  ±  279      1.88M  … 1.88M         113 ( 3%)        💩+1204.9% ±  0.0%
  cache_references   28.9K  ± 5.45K     24.4K  … 74.2K         362 ( 9%)        💩+134.5% ±  0.9%
  cache_misses        695   ± 1.82K        3   … 12.9K         639 (15%)        💩+ 48.6% ± 10.8%
  branch_misses      16.1K  ±  203      15.7K  … 20.8K         155 ( 4%)        💩+883.4% ±  0.3%
Benchmark 4 (2526 runs): ./llrt hello.js
  measurement          mean ± σ            min … max           outliers         delta
  wall_time          1.94ms ±  153us    1.80ms … 2.88ms        167 ( 7%)        💩+267.3% ±  0.9%
  peak_rss           4.85MB ±    0      4.85MB … 4.85MB          0 ( 0%)        💩+311.1% ±  0.0%
  cpu_cycles         1.95M  ±  127K     1.87M  … 3.61M         414 (16%)        💩+898.3% ±  1.5%
  instructions       1.89M  ±  672      1.88M  … 1.89M          55 ( 2%)        💩+1209.1% ±  0.0%
  cache_references   78.6K  ± 1.54K     75.6K  …  102K          69 ( 3%)        💩+537.0% ±  0.3%
  cache_misses       6.65K  ± 8.21K     1.33K  … 49.9K         404 (16%)        💩+1323.1% ± 37.8%
  branch_misses      21.6K  ±  724      21.1K  … 38.2K          74 ( 3%)        💩+1216.9% ±  0.9%
Benchmark 5 (2124 runs): ./hermes hello2.js
  measurement          mean ± σ            min … max           outliers         delta
  wall_time          2.31ms ±  322us    2.06ms … 3.88ms        224 (11%)        💩+337.7% ±  1.5%
  peak_rss           5.72MB ± 4.66KB    5.72MB … 5.77MB        449 (21%)        💩+385.2% ±  0.0%
  cpu_cycles         2.59M  ±  397K     2.35M  … 4.51M         274 (13%)        💩+1228.2% ±  4.3%
  instructions       2.92M  ±  676      2.92M  … 2.92M          18 ( 1%)        💩+1926.4% ±  0.0%
  cache_references   78.7K  ± 5.98K     73.1K  …  113K         221 (10%)        💩+537.3% ±  1.0%
  cache_misses       10.6K  ± 8.97K     3.35K  … 43.1K         192 ( 9%)        💩+2162.8% ± 41.3%
  branch_misses      15.1K  ±  240      14.6K  … 17.5K          90 ( 4%)        💩+818.4% ±  0.3%
Benchmark 6 (1402 runs): ./lo_static
  measurement          mean ± σ            min … max           outliers         delta
  wall_time          3.52ms ±  538us    3.08ms … 6.01ms        129 ( 9%)        💩+567.0% ±  2.3%
  peak_rss           12.5MB ±    0      12.5MB … 12.5MB          0 ( 0%)        💩+955.6% ±  0.0%
  cpu_cycles         4.90M  ±  866K     4.28M  … 8.69M         198 (14%)        💩+2410.5% ±  9.3%
  instructions       7.57M  ± 68.8      7.57M  … 7.57M          18 ( 1%)        💩+5157.2% ±  0.0%
  cache_references    147K  ± 9.21K      140K  …  206K         206 (15%)        💩+1092.5% ±  1.6%
  cache_misses       34.8K  ± 13.8K     18.0K  … 84.0K          59 ( 4%)        💩+7340.3% ± 63.0%
  branch_misses      26.6K  ± 1.94K     22.3K  … 45.3K          32 ( 2%)        💩+1524.5% ±  2.5%
Benchmark 7 (424 runs): ./lo hello.js
  measurement          mean ± σ            min … max           outliers         delta
  wall_time          11.8ms ±  394us    11.0ms … 13.6ms         23 ( 5%)        💩+2127.0% ±  2.4%
  peak_rss           25.6MB ±  254KB    25.0MB … 26.1MB          0 ( 0%)        💩+2069.8% ±  0.5%
  cpu_cycles         17.7M  ±  905K     16.8M  … 22.1M          47 (11%)        💩+8971.1% ±  9.8%
  instructions       22.1M  ± 4.00K     22.1M  … 22.1M           2 ( 0%)        💩+15252.9% ±  0.1%
  cache_references    816K  ± 20.5K      787K  …  907K          46 (11%)        💩+6513.1% ±  3.5%
  cache_misses        194K  ± 15.0K      180K  …  260K          10 ( 2%)        💩+41412.7% ± 70.8%
  branch_misses       115K  ± 1.56K      112K  …  125K          12 ( 3%)        💩+6924.4% ±  2.0%
Benchmark 8 (335 runs): /home/andrew/.bun/bin/bun hello.js
  measurement          mean ± σ            min … max           outliers         delta
  wall_time          14.9ms ±  291us    14.3ms … 16.0ms          4 ( 1%)        💩+2719.6% ±  2.3%
  peak_rss           38.6MB ± 1.06MB    37.5MB … 40.4MB          0 ( 0%)        💩+3173.1% ±  1.9%
  cpu_cycles         19.6M  ±  513K     19.0M  … 21.9M          15 ( 4%)        💩+9955.4% ±  5.7%
  instructions       19.5M  ± 26.3K     19.4M  … 19.6M           1 ( 0%)        💩+13414.1% ±  0.4%
  cache_references   1.20M  ± 6.69K     1.18M  … 1.23M           6 ( 2%)        💩+9589.7% ±  1.2%
  cache_misses        287K  ± 20.3K      260K  …  363K          33 (10%)        💩+61246.4% ± 94.2%
  branch_misses       151K  ± 2.74K      144K  …  178K          39 (12%)        💩+9092.8% ±  3.5%
Benchmark 9 (147 runs): /home/andrew/.node/20/bin/node hello.js
  measurement          mean ± σ            min … max           outliers         delta
  wall_time          34.1ms ± 2.61ms    29.1ms … 38.3ms          0 ( 0%)        💩+6371.0% ± 10.7%
  peak_rss           41.6MB ±  279KB    40.0MB … 41.8MB          6 ( 4%)        💩+3429.6% ±  0.5%
  cpu_cycles         71.3M  ± 1.64M     69.4M  … 87.3M           6 ( 4%)        💩+36391.2% ± 17.6%
  instructions        101M  ±  145K      101M  …  102M           2 ( 1%)        💩+70144.2% ±  2.1%
  cache_references   3.12M  ± 22.2K     3.05M  … 3.20M           7 ( 5%)        💩+25165.9% ±  3.8%
  cache_misses        420K  ± 30.9K      354K  …  549K           4 ( 3%)        💩+89795.7% ± 143.0%
  branch_misses       501K  ± 5.09K      497K  …  550K           4 ( 3%)        💩+30440.3% ±  6.5%
Benchmark 10 (149 runs): /home/andrew/.deno/bin/deno run hello.js
  measurement          mean ± σ            min … max           outliers         delta
  wall_time          33.6ms ± 4.65ms    32.4ms … 88.5ms          7 ( 5%)        💩+6259.3% ± 18.6%
  peak_rss           52.1MB ±  268KB    51.7MB … 53.2MB          1 ( 1%)        💩+4316.8% ±  0.5%
  cpu_cycles         60.4M  ± 2.48M     59.3M  … 82.9M           6 ( 4%)        💩+30840.0% ± 26.6%
  instructions        109M  ± 15.2K      109M  …  110M           3 ( 2%)        💩+75847.7% ±  0.2%
  cache_references   2.02M  ± 20.2K     2.00M  … 2.18M           5 ( 3%)        💩+16297.5% ±  3.4%
  cache_misses        550K  ± 20.1K      528K  …  699K           3 ( 2%)        💩+117531.5% ± 97.2%
  branch_misses       310K  ± 16.3K      301K  …  486K           8 ( 5%)        💩+18783.7% ± 20.8%

run

sudo ./x86_64-linux-poop "/bin/true" "/usr/local/bin/luajit-2.1.0-beta3 hello.lua" "./qjs-linux-x86_64 hello.js" "./llrt hello.js" "./hermes hello2.js" "./lo_static" "./lo hello.js" "/home/andrew/.bun/bin/bun hello.js" "/home/andrew/.node/20/bin/node hello.js" "/home/andrew/.deno/bin/deno run hello.js"

results

Benchmark 1 (7696 runs): /bin/true
  measurement          mean ± σ            min … max           outliers         delta
  wall_time           608us ± 58.2us     476us … 2.50ms       1035 (13%)        0%
  peak_rss           1.18MB ± 1.49KB    1.05MB … 1.18MB          1 ( 0%)        0%
  cpu_cycles          203K  ± 25.3K      179K  …  532K        1097 (14%)        0%
  instructions        144K  ± 1.69       144K  …  144K          85 ( 1%)        0%
  cache_references   11.6K  ±  500      10.2K  … 16.7K         780 (10%)        0%
  cache_misses        722   ± 1.21K       22   … 8.69K         639 ( 8%)        0%
  branch_misses      1.94K  ± 49.9      1.40K  … 2.27K         227 ( 3%)        0%
Benchmark 2 (5113 runs): /usr/local/bin/luajit-2.1.0-beta3 hello.lua
  measurement          mean ± σ            min … max           outliers         delta
  wall_time           939us ± 75.3us     840us … 1.69ms        672 (13%)        💩+ 54.4% ±  0.4%
  peak_rss           2.45MB ± 59.2KB    2.10MB … 2.49MB          1 ( 0%)        💩+108.1% ±  0.1%
  cpu_cycles          547K  ± 55.0K      506K  … 1.08M         701 (14%)        💩+169.8% ±  0.7%
  instructions        494K  ±  481       492K  …  496K          41 ( 1%)        💩+242.8% ±  0.0%
  cache_references   25.8K  ±  977      24.1K  … 36.1K         598 (12%)        💩+122.2% ±  0.2%
  cache_misses       2.08K  ± 2.70K      224   … 17.9K         423 ( 8%)        💩+188.2% ±  9.5%
  branch_misses      6.35K  ±  115      5.82K  … 8.41K         155 ( 3%)        💩+228.3% ±  0.2%
Benchmark 3 (4050 runs): ./qjs-linux-x86_64 hello.js
  measurement          mean ± σ            min … max           outliers         delta
  wall_time          1.20ms ± 76.5us    1.08ms … 1.89ms        518 (13%)        💩+ 96.6% ±  0.4%
  peak_rss           1.05MB ± 12.4KB     885KB … 1.05MB         25 ( 1%)        ⚡- 11.2% ±  0.0%
  cpu_cycles         1.39M  ± 62.0K     1.35M  … 2.37M         550 (14%)        💩+585.0% ±  0.8%
  instructions       1.88M  ±  286      1.88M  … 1.88M         118 ( 3%)        💩+1204.9% ±  0.0%
  cache_references   26.4K  ± 2.61K     22.7K  … 72.6K         195 ( 5%)        💩+127.4% ±  0.5%
  cache_misses        732   ± 1.76K        3   … 12.2K         429 (11%)          +  1.3% ±  7.5%
  branch_misses      16.9K  ±  195      16.0K  … 19.1K         160 ( 4%)        💩+775.2% ±  0.2%
Benchmark 4 (1758 runs): ./llrt hello.js
  measurement          mean ± σ            min … max           outliers         delta
  wall_time          2.80ms ±  209us    2.35ms … 3.90ms         48 ( 3%)        💩+360.8% ±  0.9%
  peak_rss           5.02MB ± 83.6KB    4.72MB … 5.24MB          1 ( 0%)        💩+325.2% ±  0.2%
  cpu_cycles         2.95M  ±  322K     2.62M  … 4.83M          97 ( 6%)        💩+1353.4% ±  3.6%
  instructions       2.29M  ± 4.64K     2.28M  … 2.31M          75 ( 4%)        💩+1490.8% ±  0.1%
  cache_references    135K  ± 4.22K      124K  …  170K          49 ( 3%)        💩+1065.7% ±  0.8%
  cache_misses       17.5K  ± 9.57K     7.11K  … 56.9K         103 ( 6%)        💩+2319.4% ± 30.6%
  branch_misses      28.3K  ± 5.38K     23.7K  … 42.8K         383 (22%)        💩+1359.9% ±  6.2%
Benchmark 5 (2040 runs): ./hermes hello2.js
  measurement          mean ± σ            min … max           outliers         delta
  wall_time          2.41ms ±  134us    2.21ms … 3.18ms        219 (11%)        💩+296.2% ±  0.6%
  peak_rss           5.72MB ± 6.97KB    5.60MB … 5.77MB        478 (23%)        💩+385.1% ±  0.0%
  cpu_cycles         2.54M  ±  138K     2.40M  … 3.43M         170 ( 8%)        💩+1151.8% ±  1.6%
  instructions       2.92M  ±  664      2.92M  … 2.92M          12 ( 1%)        💩+1926.7% ±  0.0%
  cache_references   77.8K  ± 2.23K     73.6K  …  103K          38 ( 2%)        💩+571.3% ±  0.5%
  cache_misses       13.0K  ± 8.88K     4.36K  … 43.3K         153 ( 8%)        💩+1697.2% ± 28.4%
  branch_misses      17.1K  ±  248      15.4K  … 22.6K          83 ( 4%)        💩+785.4% ±  0.3%
Benchmark 6 (1389 runs): ./lo_static
  measurement          mean ± σ            min … max           outliers         delta
  wall_time          3.56ms ±  227us    3.31ms … 5.40ms        154 (11%)        💩+485.0% ±  1.0%
  peak_rss           12.5MB ± 7.85KB    12.3MB … 12.5MB          5 ( 0%)        💩+955.5% ±  0.0%
  cpu_cycles         4.68M  ±  314K     4.36M  … 8.05M         122 ( 9%)        💩+2206.4% ±  3.5%
  instructions       7.58M  ± 75.1      7.58M  … 7.58M          20 ( 1%)        💩+5162.7% ±  0.0%
  cache_references    146K  ± 4.96K      139K  …  193K          59 ( 4%)        💩+1162.4% ±  1.0%
  cache_misses       37.8K  ± 13.1K     20.7K  … 83.8K           2 ( 0%)        💩+5130.7% ± 41.4%
  branch_misses      28.8K  ± 1.73K     25.5K  … 51.5K         177 (13%)        💩+1389.3% ±  2.0%
Benchmark 7 (416 runs): ./lo hello.js
  measurement          mean ± σ            min … max           outliers         delta
  wall_time          12.0ms ±  637us    11.3ms … 15.5ms         23 ( 6%)        💩+1870.2% ±  2.5%
  peak_rss           25.5MB ±  256KB    25.0MB … 26.0MB          0 ( 0%)        💩+2064.7% ±  0.5%
  cpu_cycles         18.0M  ± 1.33M     16.8M  … 25.3M          43 (10%)        💩+8758.3% ± 14.7%
  instructions       22.1M  ± 4.02K     22.1M  … 22.1M           1 ( 0%)        💩+15264.8% ±  0.1%
  cache_references    797K  ± 32.7K      749K  …  938K          21 ( 5%)        💩+6776.5% ±  6.3%
  cache_misses        193K  ± 16.1K      175K  …  252K          17 ( 4%)        💩+26582.5% ± 52.3%
  branch_misses       116K  ± 2.30K      115K  …  158K          35 ( 8%)        💩+5880.8% ±  2.7%
Benchmark 8 (337 runs): /home/andrew/.bun/bin/bun hello.js
  measurement          mean ± σ            min … max           outliers         delta
  wall_time          14.8ms ±  911us    14.0ms … 27.0ms         11 ( 3%)        💩+2335.2% ±  3.5%
  peak_rss           38.4MB ± 1.05MB    37.2MB … 40.3MB          0 ( 0%)        💩+3153.4% ±  2.0%
  cpu_cycles         21.1M  ± 1.04M     19.8M  … 30.2M          24 ( 7%)        💩+10321.0% ± 11.5%
  instructions       19.6M  ± 40.0K     19.4M  … 19.8M           4 ( 1%)        💩+13515.9% ±  0.6%
  cache_references   1.27M  ± 18.1K     1.23M  … 1.33M           3 ( 1%)        💩+10867.0% ±  3.5%
  cache_misses        291K  ± 21.8K      262K  …  411K          30 ( 9%)        💩+40135.6% ± 69.5%
  branch_misses       158K  ± 4.11K      153K  …  180K          53 (16%)        💩+8063.2% ±  4.7%
Benchmark 9 (161 runs): /home/andrew/.node/20/bin/node hello.js
  measurement          mean ± σ            min … max           outliers         delta
  wall_time          31.1ms ±  972us    30.3ms … 37.8ms         15 ( 9%)        💩+5019.5% ±  3.9%
  peak_rss           41.6MB ± 72.4KB    41.4MB … 41.7MB         38 (24%)        💩+3430.2% ±  0.1%
  cpu_cycles         72.5M  ± 2.36M     70.6M  … 82.6M          15 ( 9%)        💩+35667.5% ± 26.0%
  instructions        101M  ±  139K      101M  …  102M           4 ( 2%)        💩+70166.8% ±  2.2%
  cache_references   3.12M  ± 59.8K     3.04M  … 3.36M           7 ( 4%)        💩+26790.4% ± 11.5%
  cache_misses        432K  ± 35.1K      396K  …  689K           1 ( 1%)        💩+59679.0% ± 111.2%
  branch_misses       514K  ± 13.9K      503K  …  622K           5 ( 3%)        💩+26471.7% ± 16.1%
Benchmark 10 (155 runs): /home/andrew/.deno/bin/deno run hello.js
  measurement          mean ± σ            min … max           outliers         delta
  wall_time          32.3ms ±  843us    31.5ms … 35.8ms         11 ( 7%)        💩+5218.3% ±  3.4%
  peak_rss           51.7MB ±  256KB    51.1MB … 52.3MB          0 ( 0%)        💩+4286.2% ±  0.5%
  cpu_cycles         61.2M  ± 2.15M     59.6M  … 70.3M          18 (12%)        💩+30068.7% ± 23.7%
  instructions        109M  ± 2.01K      109M  …  109M           2 ( 1%)        💩+75882.8% ±  0.0%
  cache_references   2.04M  ± 39.8K     1.95M  … 2.22M          10 ( 6%)        💩+17473.0% ±  7.7%
  cache_misses        547K  ± 16.5K      510K  …  590K           0 ( 0%)        💩+75553.5% ± 57.2%
  branch_misses       314K  ± 16.7K      306K  …  406K           9 ( 6%)        💩+16134.4% ± 19.2%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment