The Computer Language
25.03 Benchmarks Game

Python 3 versus Node.js

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
Python 3 #6 943.88 942.63 11,874 391 3.58
Python 3 #4 311.18 1,221.85 28,701 960 5.27
Python 3 #8 2,457.09 2,455.59 11,874 414 5.65
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
Python 3 372.41 371.23 12,198 1201 5.23
Python 3 #2 442.06 440.87 12,554 1247 5.24
Python 3 #8 529.38 528.16 12,497 1172 4.94
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
Python 3 #6 349.68 348.48 13,660 334 5.44
Python 3 #4 90.37 352.91 34,693 415 5.41
Python 3 #8 386.45 385.07 12,833 334 5.08
Python 3 #7 109.91 421.84 34,578 425 5.30
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
Python 3 #7 182.94 723.28 62,173 698 5.52
Python 3 #3 879.41 877.96 45,085 319 5.26
Python 3 #2 237.64 937.87 230,973 790 5.42
Python 3 #5 260.63 1,033.16 61,620 463 5.48
Python 3 #8 1,577.29 1,575.80 45,031 379 4.84
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
Node.js 38.55 39.18—39.87 71,639 815 0.14
Python 3 #3 39.03 38.30—47.80 12,218 1007 5.32
Python 3 #2 39.06 38.61—46.82 12,415 1126 5.21
Python 3 #5 27.95 54.20—54.96 1,190,347 1951 5.52
Python 3 57.39 56.94—65.76 12,100 823 5.06
Python 3 #8 153.17 153.78—158.43 11,915 738 5.04
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
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
Python 3 #3 46.55 182.32—187.37 674,185 1970 5.68
Python 3 #4 76.67 233.00—239.32 523,751 663 4.89
Python 3 #8 234.08 235.36—236.89 642,265 525 5.15
Python 3 234.20 235.10—237.16 515,047 499 5.34
Python 3 #9 66.67 236.43—238.45 392,184 614 4.09
reverse-complement      
  elapsed Mean or 95% CI      
source secs cpu secs mem gz make
Python 3 #3 4.96 4.95 523,801 803 5.28
Python 3 #5 4.18 7.46—7.50 2,418,156 960 5.36
Python 3 #2 10.09 10.13—10.24 1,837,285 440 5.32
Python 3 10.43 10.43—10.59 2,040,713 484 5.28
Python 3 #6 7.59 11.07—11.11 2,795,930 821 5.37
Python 3 #4 13.47 13.44—13.88 4,109,324 343 5.05
* Node.js #2 15.53 16.25—16.39 763,048 1228 0.14
* 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
Python 3 #2 100.49 100.69—101.09 281,829 344 5.08
Python 3 #4 33.37 121.32—121.68 460,771 481 5.57
Python 3 34.85 123.08—123.98 445,649 597 5.16
Python 3 #5 35.37 125.71—126.12 806,117 669 5.30
Python 3 #3 51.88 148.91—149.87 819,077 1247 5.39
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
* Python 3 #3 1.35 1.28—1.32 20,009 573 5.34
Python 3 #5 1.40 1.36 15,606 369 7.20
Python 3 #4 4.63 4.60 12,718 348 4.88
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
regex-redux      [ Contentious. Different libraries. ]
  elapsed Mean or 95% CI      
source secs cpu secs mem gz make
* Python 3 #2 1.41 2.65 191,300 1411 5.48
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
Python 3 8.96 16.47—16.75 459,624 515 5.47
Python 3

Python 3.13.0

Node.js

v23.8.0