Showing posts with label julia. Show all posts
Showing posts with label julia. Show all posts

2021-12-31

String Associative Array and CombSort Benchmark 2021 Edition

Last year, we've done string associative benchmark and lesser string associative benchmark (measuring string concat operation and built-in associative array set and get), numeric comb sort benchmark and string comb sort benchmark (measuring basic array random access, string conversion, and array swap for number and string), this year's using newer server: 32-core running on 64-bit Ubuntu 21.10. This time we will skip programming languages that are no deb packages (unless the install script is just one line and doesn't ruin system directories) or no direct compile-run command like previous one, also only best of 3 runs.

$ alias time='/usr/bin/time -f "\nCPU: %Us\tReal: %es\tRAM: %MKB"

This time, NodeJS failed to complete (after waiting for an hour) with 10x more data compared to last year for assoc benchmark. Here's the spreadsheet and final result (Real duration and RAM):

LanguageCommand FlagsVersionAssocRAMNum CombRAMStr CombRAMTotalRAM
Gogo rungo1.17.512.392,305,8240.4683,0963.33245,89616.182,634,816
Javajava18-ea+15-Ubuntu-410.705,582,3080.96170,2406.93722,15218.596,474,700
Nimnim r -d:release --gc:arc1.4.217.904,200,2121.2179,4445.45633,81624.564,913,472
Pythonpypy7.3.519.703,104,4402.17140,1245.73523,26427.603,767,828
Ctcc -run0.9.2722.682,820,5681.0180,4844.80392,89628.493,293,948
Juliajulia1.6.523.983,714,4480.52255,8444.60861,07629.104,831,368
Vv -prod run0.2.4 a0a180720.368,910,8562.67124,2486.48470,13629.519,505,240
Lualuajit2.1.0-beta316.701,133,8763.27133,50410.80511,46830.771,778,848
Dartdart2.15.125.922,101,1521.40208,0565.75574,85233.072,884,060
Crystalcrystal run --release1.2.213.772,371,3207.73202,55212.08440,74833.583,014,620
Nimnim r -d:release1.4.224.923,864,1001.7679,5487.511,211,20034.195,154,848
PHPphp8.0.89.941,368,8087.74328,34424.84641,44842.522,338,600
Crystalcrystal run0.35.138.852,372,0049.97179,17622.27441,72071.092,992,900
Vv run0.2.4 a0a180751.818,911,0046.6379,71618.43470,42076.879,461,140
Pythonpython33.9.743.114,106,89229.16405,33243.08722,996115.355,235,220
Nimnim r1.4.288.053,864,0482.9379,53632.601,211,260123.585,154,844
Rubyrubyruby 2.7.4p19152.482,970,90827.15100,32052.23708,940131.863,780,168
Javascriptnodev16.13.1999.999,999,9990.71115,0446.11461,8361006.8110,576,879

FAQ

1. Why you measure the compile duration too? because developer experience also important (feedback loop, edit-rebuild/compile-run), at least for me, it would be sucks a lot if we have to wait a minute to compile before we can test something. We could always write precalculated values with C++ template to make runtime faster for example, but the compilation delay would be very sucks.
2. Why not warming up the VM first? each implementation have it's own advantage and disadvantage. We already know, that compiled language mostly faster at runtime, but at cost of relatively slower development feedback loop. Interpreted language mostly slower at runtime, especially if executed using VM that have startup overhead, in exception of one with AOT or JIT optimization. So to make it fair for every kind of implementation, we do it differently by not glorifying the runtime performance (which super make sense for server or long-lived process, but not best for development or CI cost which people often neglected), but by total performance which consist of Compile duration (if any) + VM startup duration (if any) + AOT or JIT duration (if any) + Runtime duration, so every strategy the PL's implementator use can be fairly judged.
3. Why there's no C++, VB.NET, C#, D, Object-Pascal? don't want to compile things (since there's no build and run command in one flag).  
4. Why there's no Kotlin, Scala, Rust, Elixir, Pony, Swift, Groovy, or Zig? Too lazy to add :3 you can contribute tho (create a pull request, then I'll run the benchmark again as preferably as there's precompiled binary/deb/apt/ppa repository for the compiler/interpreter).
5. Why there's no Ruby 3.1? I can't find any PPA for latest Ruby, latest one on Ubuntu 21.10 repo is Ruby2.7.

Contributorsilmanzo (Nim, Crystal, D), inkydragon (Julia)

2021-07-08

Prime Benchmark

So, yesterday I didn't touch my PC to do a prime number benchmark. And Here's the result for single threaded (only showing fastest implementation of each language) and multithreaded:

IndexImplementationSLabelPassesDurAlgoFaithfulBitPasses/Second
1cpp3flo80_2206675.00baseno144133.26760
10c2daniel202505.00wheelyes14049.85259
11zig3ManDeJ179645.00baseno13592.49823
12c2daniel176815.00wheelyes13536.07129
16rust1mike-b158045.01baseyes83152.68929
20assembly1rberge144345.00baseno82886.80000
22haskell1fatho/119595.00baseno82391.77321
32fortran1johand99875.00baseno11997.40000
36crystal1marghi86805.00baseyes11735.86981
38fsharp3dmanno77545.00baseyes1550.68897
40java1Mansen1488710.0baseyes1488.70000
41csharp1kinema72715.00baseyes1454.08077
43julia2epithe69535.00baseyes11390.55577
46go2ssoves61615.00baseyes11232.01471
51nodejs1rogier57485.00baseyes11149.43213
57lisp2mayerr51225.00baseno11024.19803
58typescript1marghi50315.00baseyes1006.20000
59d2Bradle50035.00baseyes11000.52396
61v1marghi43295.00baseyes865.80000
63lua2ben1je31595.00baseno1631.80000
64nim2beef3328715.00baseyes1574.02096
67cython1rpkak26595.00baseyes8531.64832
71basic1rberge24165.00wheelyes1483.00680
73assemblyscript1donmah423110.0baseyes423.05768
74python2ssoves19915.00baseyes8398.09742
80scala1rom1de12035.00baseyes240.55189
81pascal1rberge11625.00baseyes232.40000
82cobol1fvbake11575.00baseno8231.40000
83pony1marghi11445.00baseyes1228.80000
84swift1j-f1204610.0baseyes204.55332
85dart1eagere8245.00baseyes164.77795
86haxe1TayIor139210.0baseyes139.19035
88ada1BoopBe6615.00baseno132.02220
92octave1octave3135.00baseno62.54234
93postscript1epithe2165.01baseno843.08797
94ruby1rberge1195.01baseyes23.71935
95wren1marghi1115.00baseyes22.16446
96php1Dennis14310.0baseyes14.24667
97smalltalk1fvbake495.07baseyes19.66469
99mixal1rberge304.91baseno16.10998
100perl1marghi285.16baseyes5.42031
103r1fvbake75.43baseyes321.28842
104sql2fvbake65.43otherno321.10375
105tcl1fvbake65.47baseyes11.09589
111latex1tjol217.8baseno320.11224
112bash1bash110.6baseno0.09357

IndexImplementationSLabelPassesDurThreadAlgoFaithfulBitPasses/Second
1zig3ManDe1409105.04wheelno17045.26046
2cpp3flo802361845.08baseno15904.57992
3zig3ManDe1063995.04wheelno15319.64146
4zig3ManDe1010265.04wheelno15051.08785
5zig3ManDe840025.04wheelno14200.08320
6zig3ManDe1478225.08wheelno13695.38740
7zig3ManDe720215.04wheelno13600.73314
8zig3ManDe705225.04wheelno13525.83204
9zig3ManDe1341245.08wheelno13352.91894
10zig3ManDe598515.04baseno82992.45424
11c2danie1013915.08wheelyes12534.43285
12zig3ManDe982465.08wheelno12455.98299
13zig3ManDe981905.08wheelno12454.57327
14zig3ManDe481645.04baseno12408.10849
15zig3ManDe917455.08wheelno12293.50574
16zig3ManDe905985.08wheelno12264.84129
17c2danie881035.08wheelyes12199.97727
18zig3ManDe423185.04baseno12115.85768
19c2danie788585.08wheelyes11969.05838
20zig3ManDe684925.08baseno81712.11852
21c2danie637525.08wheelyes11591.86334
22rust1mike-590015.08baseyes81474.83765
23rust1mike-529795.08baseyes11324.32205
24c2danie498225.08baseyes11244.43126
25zig3ManDe497125.08baseno11242.59124
26c2danie246645.04wheelyes11233.15067
27rust1mike-492385.08baseyes11230.78145
28zig3ManDe456365.08baseno11140.80189
29c2danie223785.04wheelyes11118.88478
30c2danie203855.04wheelyes11019.22065
31c2danie202575.04wheelyes11012.82346
32c2danie151325.04baseyes1756.55294
33cpp2davep200485.08baseyes1501.18496
34d2Bradl195535.08baseyes1488.74973
35zig3ManDe92405.04baseno8461.94272
36zig3ManDe118345.08baseno8295.81332
37csharp1kinem31935.08wheelyes179.81766
38csharp1kinem29615.08baseyes174.02041

Raw result on this gist

2016-11-14

Crystal Internal Benchmark (Nov 2016)

Update the snapshot of benchmark by Kostya. See the previous (April 2015) snapshot here.

  • gcc (Ubuntu 4.8.2-19ubuntu1) 4.8.2
  • Nim Compiler Version 0.14.0 (2016-06-06) [Linux: amd64]
  • Crystal 0.19.2 [d81c32c] (2016-09-16)
  • go version go1.7 linux/amd64
  • gccgo (Ubuntu 4.9.1-0ubuntu1) 4.9.1
  • DMD64 D Compiler v2.068.0
  • gdc (crosstool-NG crosstool-ng-1.20.0-232-gc746732 - 20150830-2.066.1-dadb5a3784) 5.2.0
  • LDC - the LLVM D compiler (0.15.2-beta1)
  • V8 version 3.29.62 (candidate)
  • rustc 1.11.0 (9b21dcd6a 2016-08-15)
  • Scala version 2.11.6 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_45)
  • Nodejs v7.0.0
  • PyPy 4.0.0 with GCC 4.8.4
  • topaz (ruby-1.9.3p125) (git rev b95c858) [x86_64-linux]
  • ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-linux]
  • Python 2.7.6 and  3.5.2
  • rubinius 2.2.10 (2.1.0 bf61ae2e 2014-06-27 JI) [x86_64-linux-gnu]
  • jruby 1.7.20 (1.9.3p551) 2015-05-04 3086e6a on Java HotSpot(TM) 64-Bit Server VM 1.8.0_45-b14 +jit [linux-amd64]
  • jruby 9.0.0.0.pre2 (2.2.2) 2015-04-28 2755ae0 Java HotSpot(TM) 64-Bit Server VM 25.45-b02 on 1.8.0_45-b14 +jit [linux-amd64]
  • Java version "1.8.0_45" Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)
  • julia version 0.4.3
  • clang version 3.5-1ubuntu1 (trunk) (based on LLVM 3.5)
  • Mono JIT compiler version 4.0.1 (tarball Tue May 12 15:39:23 UTC 2015)
  • rock 0.9.10-head codename sapphire, built on Wed Jul 1 20:09:58 2015
  • Felix version 15.04.03
  • Q KDB+ 3.3 2015.09.02 Copyright (C) 1993-2015 Kx Systems
  • perl 5, version 18, subversion 2 (v5.18.2) built for x86_64-linux-gnu-thread-multi
  • The Glorious Glasgow Haskell Compilation System, version 7.10.2
  • Tcl 8.6
  • jq version 1.3
  • Swift version 2.2-dev (LLVM ae2eb212e4, Clang ef4c02f431, Swift 634acb40a1)
  • Kotlin version 1.0.3 (JRE 1.8.0_45-b14)
  • PHP 7.0.9-1+deb.sury.org~trusty+1 (cli) ( NTS )
  • .Net Core 1.0.0-preview2-003121

Havlak loop finder
LanguageTime, sMemory, MiB
Crystal15.46443.2
Nim Gcc16.59484.3
Nim Clang16.91477.9
C++17.72174.5
D Ldc25.15214.9
D28.90418.2
Go31.26349.9
D Gdc31.79197.6
Scala32.18363.0
Go Gcc32.94365.7
C# Mono40.54270.0
Python Pypy45.51625.9
C# .Net Core61.38388.8
Python396.54724.0

Matrix multiplication
LanguageTime, sMemory, MiB
Julia Native Thr0.11148.3
Julia Native0.31175.8
D Mir GLAS0.3256.7
D Ldc2.0168.9
D2.3071.3
D Gdc2.3373.0
Python Numpy3.0865.3
Java3.50136.2
Scala3.62136.2
Kotlin3.62132.2
C3.6469.2
Nim Clang3.73142.3
Rust3.7476.9
Nim Gcc3.82146.0
Go3.8373.5
Crystal3.8573.9
Go Gcc3.9084.5
Swift4.48110.8
Javascript Node5.9588.3
Javascript V86.8781.5
Python Pypy7.68122.6
C# .Net Core10.8785.7
C# Mono15.1783.6
Julia20.98187.4
Ruby Topaz81.41206.2
Ruby338.4082.8
Python447.3974.0
Ruby JRuby416.12582.4
Ruby JRuby9k467.59608.3
Ruby Rbx591.70325.0
Perl666.46604.1
Tcl1066.66279.9

JSON parse
LanguageTime, sMemory, MiB
D Gdc Fast0.34226.7
C++ Rapid SAX0.721.0
Rust Pull0.78207.9
Rust Struct0.79232.5
C++ Gason0.83582.2
C++ Rapid0.94243.6
Java1.47621.2
Crystal Schema1.93331.2
Rust Value2.511967.0
Perl XS2.68888.4
Crystal3.001115.2
Javascript Node3.21863.7
Crystal Pull3.301.6
Nim Clang4.121089.6
Python3 ujson4.151303.2
Nim Gcc4.461090.1
Python Pypy4.811553.0
Python ujson5.071352.9
Q5.18684.0
Go5.21479.3
C++ LibJson5.492796.3
Clojure5.811148.5
Python35.821037.8
C# .Net Core6.31834.9
Php6.371502.0
Ruby YAJL8.231085.5
Haskell8.3170.5
Python9.851409.1
C# Mono10.57812.1
Julia11.892622.4
D12.421417.1
Ruby12.672013.9
JQ14.921714.5
Scala15.471415.8
C++ Boost16.442915.2
Ruby JRuby9K16.532050.5
Go Gcc17.64473.1
Ruby JRuby21.982761.1
D Gdc25.86926.1
D Ldc27.23919.6
Perl46.021635.4
Ruby Rbx67.134681.0

Base64 encode and decode

LanguageTime, sMemory, MiB
C aklomp SSSE30.9332.3
C1.8532.2
Crystal2.3085.0
D Gdc2.5233.3
Ruby2.73125.3
D Ldc3.1453.1
Perl XS3.6347.9
Rust3.6442.9
Ruby Rbx4.2930.7
Nim Gcc4.6252.7
Nim Clang4.7052.7
Julia4.41190.0
Javascript Node4.76551.5
C++ Openssl5.4565.2
Php6.3453.4
C# .Net Core6.52121.1
D7.1855.3
Tcl7.2066.0
Python Pypy7.32582.3
Python7.6252.6
Go8.0070.0
Python38.1354.5
C# Mono9.0171.7
Java9.06971.2
Kotlin9.75932.9
Scala10.69292.5
Ruby JRuby9K12.16530.6
Ruby JRuby12.65514.9
Perl33.3099.7
Go Gcc39.56185.5
Mandelbrot in Brainfuck
LanguageTime, sMemory, MiB
C++ Gcc20.491.7
Crystal23.131.5
D Ldc24.901.4
Rust25.194.9
D Gdc29.492.4
Nim Gcc31.042.7
Nim Clang37.392.9
Go Gcc37.5911.4
Kotlin40.7934.9
Scala58.51120.12
Java58.86423.9
D Dmd62.691.7
Javascript Node88.3418.6
Go102.852.2
Python Pypy126.4778.9
C# .Net Core142.3017.8
C# Mono147.6912.6
Ruby Topaz305.7938.8

Brainfuck interpreter
LanguageTime, sMemory, MiB
Kotlin1.7828.4
C++ Gcc1.941.0
D Ldc2.020.9
Rust2.494.9
Nim Gcc2.560.7
D Gdc3.051.4
Nim Clang3.090.8
Scala3.43120.12
Crystal3.461.3
Java4.03513.8
Go Gcc4.2010.0
D Dmd5.231.0
Go5.360.9
Javascript V86.537.9
Javascript Node7.3816.9
C# .Net Core16.0316.9
C# Mono19.8614.6
Python Pypy20.6477.9
Ruby Topaz59.5336.5
Ruby Rbx120.3832.3
Ruby Jruby129.75267.6
Ruby Jruby9k134.18286.8
Ruby181.447.2
Python314.794.9
Python3412.135.5