{"id":31543739,"url":"https://github.com/andrewmcwattersandco/programming-language-benchmarks","last_synced_at":"2025-10-04T12:42:29.184Z","repository":{"id":106412026,"uuid":"480091234","full_name":"andrewmcwattersandco/programming-language-benchmarks","owner":"andrewmcwattersandco","description":"Benchmarks for programming languages","archived":false,"fork":false,"pushed_at":"2025-09-26T19:38:20.000Z","size":2515,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-04T12:42:27.953Z","etag":null,"topics":["benchmark","c","lua","luajit","programming-language-benchmarks"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/andrewmcwattersandco.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-04-10T17:33:34.000Z","updated_at":"2025-09-26T19:38:23.000Z","dependencies_parsed_at":null,"dependency_job_id":"cdb32881-70c1-4e27-b54a-06903ae0a5e8","html_url":"https://github.com/andrewmcwattersandco/programming-language-benchmarks","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/andrewmcwattersandco/programming-language-benchmarks","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewmcwattersandco%2Fprogramming-language-benchmarks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewmcwattersandco%2Fprogramming-language-benchmarks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewmcwattersandco%2Fprogramming-language-benchmarks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewmcwattersandco%2Fprogramming-language-benchmarks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andrewmcwattersandco","download_url":"https://codeload.github.com/andrewmcwattersandco/programming-language-benchmarks/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewmcwattersandco%2Fprogramming-language-benchmarks/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278315190,"owners_count":25966774,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-04T02:00:05.491Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["benchmark","c","lua","luajit","programming-language-benchmarks"],"created_at":"2025-10-04T12:42:24.083Z","updated_at":"2025-10-04T12:42:29.179Z","avatar_url":"https://github.com/andrewmcwattersandco.png","language":"C++","readme":"# programming-language-benchmarks\nBenchmarks for programming languages\n\n## Languages and implementations[*](#excluded-programming-languages)\n* C\n* C++\n* C#\n* Go\n* Java\n* JavaScript\n* Lua\n* LuaJIT\n* PHP\n* Python\n* Ruby\n* Rust\n* Zig\n\n## Philosophy\n* **Real-world tests only**  \n  Most developers are not writing code that looks like the 1994 FANNKUCH\n  Benchmark, nor running N-body simulations.\n* **Use the most popular libraries**  \n  The speed and memory efficiency of programming languages should not be\n  evaluated without considering the ecosystems around them. When benchmarking\n  an HTTPS server in Node.js, most developers will be considering the speed of\n  Express, not `http.createServer()`.\n\n  **NEW** For web server benchmarks, see\n  [andrewmcwattersandco/web-server-benchmarks][1].\n* **Use idiomatic code/Do not use micro-optimizations**  \n  One can write inline assembly in C with the non-standard `asm` keyword or use\n  `ffi.cdef` from LuaJIT to create C data structures instead of Lua tables, but\n  the tests within this benchmark are designed to reflect typical usage of each\n  respective language.\n\n  Further, some implementations of languages rely on specific hinting to\n  trigger optimizations, like knowing the exact layout of a record ahead of\n  time to avoid growing or shrinking backing memory by powers of two.\n\n  Most developers are not aware of such optimizations and this benchmark makes\n  no attempts to catalog them. Instead, tests are written in a way that first\n  reflects the documentation provided by the language authors, who themselves\n  often do not publicize such optimizations.\n\n## Run\n```sh\n./bench [-t tests...] [-l languages...] [-s languages...]\n```\n\n### macOS\n#### node\n`bench` runs from `/bin/sh`. If you have `node` installed through `nvm`, you may\nneed to create a symbolic link to the default installation path.\n```\nsudo ln -s $(command -v node) /usr/local/bin/node\n```\n\n## Tests\n* **Minimal program**  \n  Test initialization\n* **Create a record/structure/object**  \n  Test memory allocation\n\n  _Note: Creates 8,388,608 records. Last tested against node v24.3.0, 67,108,864\n  is the maximum array size. All other test languages have their tests\n  calibrated to this number, which is the smallest array length of all of the\n  test languages before one of the tests is terminated abnormally._\n\n  _Edit: This test previously created 67,108,864 records._\n* **Parse JSON**  \n  Test built-in or de facto standard JSON parser\n\n## Results\nOur findings confirm conventional wisdom that low-level compiled languages are\nfaster than managed code, and that managed code runs faster than interpreted\ncode. The results also show that the performance of a programming language\nis not solely determined by its implementation, but also by the libraries and\nframeworks that are used with it.\n\n### Physical\n*Last updated: Thu Aug 21 21:34:46 MST 2025*\n```sh\n% ./bench\njson\n cpp            mean 1738.3 µs\t\n c              mean 3054.0 µs\t\n rust           mean 3692.2 µs\t\n zig            mean 3906.9 µs\t\n go             mean 6968.4 µs\t\n luajit         mean 9938.0 µs\t\n python3        mean 30460.8 µs\t\n js             mean 33187.1 µs\t\n cs             mean 35628.1 µs\t\n lua            mean 49366.6 µs\t\n php            mean 52403.9 µs\t\n ruby           mean 59341.7 µs\t\n java           mean 170049.5 µs\t\nminimal\n c              mean 1217.1 µs\t\n zig            mean 1534.4 µs\t\n go             mean 1542.4 µs\t\n cpp            mean 1549.0 µs\t\n rust           mean 1550.7 µs\t\n luajit         mean 1602.0 µs\t\n lua            mean 1747.0 µs\t\n python3        mean 21472.0 µs\t\n cs             mean 22668.2 µs\t\n js             mean 28519.2 µs\t\n java           mean 31884.8 µs\t\n php            mean 50319.9 µs\t\n ruby           mean 51489.4 µs\t\nrecord\n cpp            mean 738.2 µs\t\n c              mean 1215.0 µs\t\n zig            mean 4460.7 µs\t\n rust           mean 7152.0 µs\t\n go             mean 9709.3 µs\t\n java           mean 80830.2 µs\t\n cs             mean 378984.8 µs\t\n js             mean 626475.8 µs\t\n luajit         mean 658569.1 µs\t\n php            mean 762029.6 µs\t\n lua            mean 1279559.3 µs\t\n ruby           mean 1446871.1 µs\t\n python3        mean 4236537.6 µs\t\n```\n\n### Google Sheets\nhttps://docs.google.com/spreadsheets/d/1oBtZTcp4UzRTWnTsBwxr465XAZhVuso33EJINMAKUQo/edit?usp=sharing\n\n## Hardware\n### Physical\nMacBook Pro (16-inch, 2021)  \nApple M1 Max chip with 10-core CPU, 32-core GPU, and 16-core Neural Engine  \n64GB unified memory  \n1TB SSD storage  \nhttps://www.apple.com/shop/buy-mac/macbook-pro/16-inch-space-gray-10-core-cpu-32-core-gpu-1tb#\n\n### Cloud\nGitHub Actions\n\n* * *\n\n###### Excluded programming languages\n\u003csub\u003e\\* We do not benchmark Bash/Shell, TypeScript, or PowerShell. We do not\nbenchmark **programming languages predominantly used for a single domain**,\nlike Kotlin for Android development, Dart for Flutter, Swift for iOS\ndevelopment, or MicroPython for embedded systems. We are unable to benchmark\nHTML/CSS, SQL, and assembly. We do not benchmark **programming languages that\nare not widely used in production,** like Groovy, Elixir, Scala, Delphi, Lisp,\nErlang, Fortran, Ada, F#, OCaml, Gleam, Prolog, COBOL, or Mojo. We do not\nbenchmark **programming languages that are no longer supported, updated, or\nones which \"won't be extended to new workloads\"** like Visual Basic (.NET) or\nVBA. We do not benchmark **programming languages predominantly used for\nstatistical computing or data analysis**, like R or MATLAB. We do not benchmark\n**custom scripting languages** like GDScript. We do not benchmark **programming\nlanguages that are write-ins in the Stack Overflow Developer Survey.**\u003c/sub\u003e\n\n## License\nGNU General Public License v2.0\n\n[1]: https://github.com/andrewmcwattersandco/web-server-benchmarks\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrewmcwattersandco%2Fprogramming-language-benchmarks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandrewmcwattersandco%2Fprogramming-language-benchmarks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrewmcwattersandco%2Fprogramming-language-benchmarks/lists"}