Showing posts with label nim. Show all posts
Showing posts with label nim. 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)

2019-07-25

The Benchmarker's Web Framework Benchmark

Latest update (2019-07-19) from the-benchmarker's web-framework:

Language (Runtime)Framework (Middleware)Requests / sThroughput
c (11)agoo-c (0.5)199670.00115.49 MB
python (3.7)japronto (0.1)177634.00212.57 MB
java (8)rapidoid (5.5)153167.00275.56 MB
go (1.12)fasthttprouter (0.1)146986.67236.54 MB
python (3.6)vibora (0.0)144171.33163.66 MB
c (99)kore (3.1)142837.67370.30 MB
cpp (11)evhtp (1.2)141011.33136.87 MB
java (8)act (1.8)137266.33236.87 MB
ruby (2.6)agoo (2.8)132990.6776.84 MB
rust (1.36)gotham (0.4)130192.33266.35 MB
crystal (0.29)router.cr (0.2)123911.33116.40 MB
nim (0.2)jester (0.4)123719.00248.70 MB
crystal (0.29)raze (0.3)122186.33114.87 MB
crystal (0.29)spider-gazelle (1.4)120138.00128.27 MB
crystal (0.29)kemal (0.25)114424.33187.01 MB
rust (1.36)actix-web (1.0)114286.67163.27 MB
crystal (0.29)amber (0.28)105704.33193.62 MB
rust (1.36)nickel (0.11)102067.33202.98 MB
csharp (7.3)aspnetcore (2.2)100367.67163.49 MB
rust (1.36)iron (0.6)99692.33125.66 MB
crystal (0.29)orion (1.7)95829.67156.64 MB
go (1.12)gorouter (4.0)91250.00121.51 MB
node (12.6)polkadot (1.0)90498.00135.64 MB
go (1.12)chi (4.0)89401.33119.52 MB
node (12.6)0http (1.0)88940.67133.26 MB
go (1.12)gin (1.4)88229.00154.70 MB
go (1.12)violetear (7.0)87979.00116.68 MB
node (12.6)restana (3.3)87181.67130.61 MB
go (1.12)echo (4.1)86944.33152.32 MB
go (1.12)kami (2.2)85569.00113.85 MB
go (1.12)beego (1.12)83531.33112.24 MB
go (1.12)gorilla-mux (1.7)83107.67110.75 MB
kotlin (1.3)ktor (1.2)76189.67118.63 MB
go (1.12)gf (1.8)73145.67110.94 MB
node (12.6)polka (0.5)71049.67106.46 MB
scala (2.12)akkahttp (10.1)69006.00147.87 MB
node (12.6)rayo (1.3)68066.67102.05 MB
python (3.7)falcon (2.0)60301.00141.34 MB
swift (5.0)perfect (3.1)60239.6756.60 MB
node (12.6)muneem (2.4)58723.6787.98 MB
scala (2.12)http4s (0.18)58317.33102.08 MB
node (12.6)fastify (2.6)58029.33147.94 MB
node (12.6)foxify (0.1)53745.00112.74 MB
java (8)spring-boot (2.1)52174.0039.04 MB
node (12.6)koa (2.7)50993.67107.80 MB
python (3.7)blacksheep (0.1)50145.67102.88 MB
python (3.7)bottle (0.12)49704.67122.36 MB
node (12.6)restify (8.2)45617.0079.87 MB
php (7.3)slim (3.12)43847.33217.11 MB
php (7.3)zend-expressive (3.2)42281.00209.34 MB
php (7.3)symfony (4.3)42019.67208.50 MB
python (3.7)starlette (0.12)41710.6789.72 MB
node (12.6)express (4.17)41081.33100.31 MB
php (7.3)zend-framework (3.1)39650.00196.61 MB
swift (5.0)kitura (2.7)39061.3372.50 MB
ruby (2.6)roda (3.22)38720.6736.90 MB
swift (5.0)vapor (3.3)38685.0064.54 MB
python (3.7)hug (2.5)37882.3393.84 MB
php (7.3)lumen (5.8)37822.00196.49 MB
ruby (2.6)cuba (3.9)35257.0041.55 MB
crystal (0.28)lucky (0.14)33885.0041.73 MB
crystal (0.29)onyx (0.5)32685.6783.76 MB
node (12.6)turbo_polka (2.0)31139.6729.22 MB
ruby (2.6)rack-routing (0.0)29710.3317.13 MB
node (12.6)hapi (18.1)29298.3375.73 MB
php (7.3)laravel (5.8)28941.33151.14 MB
swift (5.0)kitura-nio (2.7)28372.0053.53 MB
python (3.7)fastapi (0.33)27457.6759.12 MB
python (3.7)aiohttp (3.5)23169.0052.40 MB
ruby (2.6)flame (4.18)20298.3311.70 MB
python (3.7)molten (0.27)19610.0036.40 MB
python (3.7)flask (1.1)19088.3346.94 MB
ruby (2.6)hanami (1.3)18242.67137.89 MB
rust (nightly)rocket (0.4)17988.3327.86 MB
python (3.7)bocadillo (0.18)17408.3333.59 MB
python (3.7)sanic (19.6)14934.0026.61 MB
ruby (2.6)sinatra (2.0)14907.3338.66 MB
swift (5.0)swifter (1.4)11351.6714.52 MB
python (3.7)quart (0.9)10817.6721.55 MB
python (3.7)responder (1.3)8826.3319.23 MB
python (3.7)django (2.2)7604.6722.02 MB
python (3.7)tornado (5.1)7089.3320.92 MB
python (3.7)masonite (2.2)6298.6715.47 MB
crystal (0.29)athena (0.7)6247.677.81 MB
ruby (2.6)rails (5.2)3680.3311.28 MB
python (3.7)cyclone (0.0)2889.337.85 MB
It's interesting to see new frameworks (or one that I never heard of.. Vibora, Agoo, and Gotham for example) performing well.
But as usual, this just router, the bottleneck is mostly always the database.