The Computer Language
25.03 Benchmarks Game

Node.js versus Lua

How the programs are written matters! Always look at the source code.

If the fastest programs are flagged * possible hand-written vector instructions or "unsafe" or naked ffi, does the host language matter? You might be more interested in the less optimised programs — more seconds, less gz source code.

fannkuch-redux      
  elapsed Mean or 95% CI      
source secs cpu secs mem gz make
Node.js #5 11.07 43.76—44.47 111,055 1320 0.14
Node.js #8 58.32 58.31 64,094 452 0.13
Lua 604.54 604.44 3,330 469 0.17
n-body      
  elapsed Mean or 95% CI      
source secs cpu secs mem gz make
Node.js #6 8.55 8.60—8.73 67,244 1274 0.11
Node.js #8 9.63 9.64—9.99 66,695 1173 0.16
Lua #2 216.21 222.12—231.65 3,269 1200 0.10
Lua #4 216.59 224.22—232.39 3,273 1312 0.18
Lua 244.50 250.36—259.88 3,273 1207 0.19
spectral-norm      
  elapsed Mean or 95% CI      
source secs cpu secs mem gz make
Node.js #7 5.40 5.40 66,163 420 0.12
Node.js 5.41 5.38—5.51 67,637 326 0.15
Node.js #6 1.60 6.03 116,212 1002 0.14
Node.js #8 6.53 6.53 66,642 355 0.14
Lua 77.63 77.91—90.12 3,568 335 0.19
mandelbrot      
  elapsed Mean or 95% CI      
source secs cpu secs mem gz make
Node.js #3 4.05 15.86—15.92 144,757 1128 0.15
Node.js #2 29.41 29.44 73,617 422 0.11
Node.js 69.02 72.84—75.47 69,100 380 0.15
Node.js #8 70.31 73.08—75.99 68,338 412 0.11
Lua #3 487.31 487.90—488.97 3,711 364 0.18
Lua 500.61 500.82—501.71 3,707 365 0.16
Lua #2 523.44 524.95—527.02 3,232 373 0.15
Lua #6 159.01 557.36—558.01 652,796 630 0.10
fasta      
  elapsed Mean or 95% CI      
source secs cpu secs mem gz make
* Node.js #5 2.56 7.10—7.15 120,930 2050 0.14
Node.js #8 18.98 19.26—19.53 74,129 742 0.13
Lua #2 24.14 24.33—26.33 3,686 1065 0.20
Lua #3 24.15 24.17—25.73 3,682 1065 0.18
Node.js 38.55 39.18—39.87 71,639 815 0.14
k-nucleotide      
  elapsed Mean or 95% CI      
source secs cpu secs mem gz make
Node.js #3 15.99 43.91—44.53 448,524 1817 0.14
Lua #2 90.52 90.72—91.24 613,040 620 0.15
Node.js #8 105.52 109.35—113.96 734,392 678 0.13
Node.js #2 35.57 110.72—113.74 1,897,566 941 0.13
Node.js 37.72 115.01—117.24 1,361,019 1011 0.13
reverse-complement      
  elapsed Mean or 95% CI      
source secs cpu secs mem gz make
* Node.js #2 15.53 16.25—16.39 763,048 1228 0.14
Lua #2 38.73 38.89—39.62 2,724,770 560 0.18
Lua #5 42.84 44.40—45.94 2,227,048 758 0.20
Lua #4 46.06 46.12—48.03 653,398 600 0.18
* Node.js #7   Bad Output  
binary-trees      [ Contentious. Different approaches. ]
  elapsed Mean or 95% CI      
source secs cpu secs mem gz make
Node.js #7 16.07 28.29—28.55 1,128,059 458 0.10
Node.js #6 8.61 30.92—31.04 1,275,720 752 0.06
Node.js 8.94 33.89—34.14 1,389,228 717 0.09
Lua #2 142.32 145.28—148.96 1,043,743 418 0.13
Lua #3 82.05 164.78—165.70 1,753,616 690 0.18
Lua #4 47.56 175.72—176.19 2,055,766 670 0.16
pidigits      [ Contentious. Different libraries. ]
  elapsed Mean or 95% CI      
source secs cpu secs mem gz make
Node.js #4 1.15 1.16 71,688 487 0.14
* Lua 2.99 3.02 24,666 482 0.13
Node.js #2 12.17 12.15—12.42 102,679 405 0.10
Node.js #3 12.25 12.23—12.38 102,257 431 0.12
* Lua #7   Empty  
Lua #6   Empty  
* Lua #5   Empty  
regex-redux      [ Contentious. Different libraries. ]
  elapsed Mean or 95% CI      
source secs cpu secs mem gz make
Lua 2.59 2.59 360,264 488 0.17
Node.js #3 4.35 5.71—5.92 840,503 675 0.12
Node.js #4 5.47 5.63—5.76 1,036,935 471 0.14
Node.js

v23.8.0

Lua

Lua 5.4.7 Copyright (C)
1994-2024 Lua.org, PUC-Rio