HFTrader / Programming-Language-Benchmarks

Yet another implementation of computer language benchmarks game

Home Page:https://programming-language-benchmarks.vercel.app/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bench MIT License

Why Build This

The idea is to build an automated process for benchmark generation and publishing.

Comparable numbers

It currently use CI to generate benchmark results to guarantee all the numbers are generated from the same environment at nearly the same time. All benchmark tests are executed in a single CI job

Automatic publishing

Once a change is merged into main branch, the CI job will re-generate and publish the static website

Main Goals

  • Compare performance differences between different languages. Note that implementations might be using different optimizations, e.g. with or w/o multithreading, please do read the source code to check if it's a fair comparision or not.
  • Compare performance differences between different compilers or runtimes of the same language with the same source code.
  • Facilitate benchmarking on real server environments as nowadays more and more applications are deployed with docker/k8s. It's likely to get a very different result from what you get on your dev machine.
  • A reference for CI setup / Dev environment setup / package management setup for different languages. Refer to Github action
  • It focuses more on new programming languages, classic programming languages that are covered by CLBG receive limited or no maintainence, based on their popularity.

Build

To achieve better SEO, the published site is static and prerendered, powered by nuxt.js.

Host

The website is hosted on Vercel

Development

git clone https://github.com/hanabi1224/Programming-Language-Benchmarks.git

cd website
pnpm i
pnpm build
pnpm dev

Benchmarks

All benchmarks are defined in bench.yaml

Current benchmarks problems and their implementations are from The Computer Language Benchmarks Game ( Repo)

Local development

Prerequisites

net7

nodejs 14

pnpm

podman (or docker by changing docker_cmd: podman to docker_cmd: docker in bench/bench.yaml)

Build

The 1st step is to build source code from various of lanuages

cd bench
# To build a subset
dotnet run -p tool -- --task build --langs lisp go --problems nbody helloworld --force-rebuild
# To build all
dotnet run -p tool -- --task build

Test

The 2nd step is to test built binaries to ensure the correctness of their implementation

cd bench
# To test a subset
dotnet run -p tool -- --task test --langs lisp go --problems nbody helloworld
# To test all
dotnet run -p tool -- --task test

Bench

The 3rd step is to generate benchmarks

cd bench
# To bench a subset
dotnet run -p tool -- --task bench --langs lisp go --problems nbody helloworld
# To bench all
dotnet run -p tool -- --task bench

For usage

cd bench
dotnet run -p tool -- -h

BenchTool
  Main function

Usage:
  BenchTool [options]

Options:
  --config <config>              Path to benchmark config file [default: bench.yaml]
  --algorithm <algorithm>        Root path that contains all algorithm code [default: algorithm]
  --include <include>            Root path that contains all include project templates [default: include]
  --build-output <build-output>  Output folder of build step [default: build]
  --task <task>                  Benchmark task to run, valid values: build, test, bench [default: build]
  --force-pull-docker            A flag that indicates whether to force pull docker image even when it exists [default: False]
  --force-rebuild                A flag that indicates whether to force rebuild [default: False]
  --fail-fast                    A Flag that indicates whether to fail fast when error occurs [default: False]
  --build-pool                   A flag that indicates whether builds that can run in parallel [default: False]
  --verbose                      A Flag that indicates whether to print verbose infomation [default: False]
  --no-docker                    A Flag that forces disabling docker [default: False]
  --langs <langs>                Languages to incldue, e.g. --langs go csharp [default: ]
  --problems <problems>          Problems to incldue, e.g. --problems binarytrees nbody [default: ]
  --environments <environments>  OS environments to incldue, e.g. --environments linux windows [default: ]
  --version                      Show version information
  -?, -h, --help                 Show help and usage information

Referesh website

Lastly you can re-generate website with latest benchmark numbers

cd website
pnpm i
pnpm content
pnpm build
serve dist

TODOs

Intergrate test environment info into website

Intergrate build / test / benchmark infomation into website

...

How to contribute

TODO

Thanks

This is inspired by The Computer Language Benchmarks Game, thanks to the curator.

LICENSES

Code of problem implementation from The Computer Language Benchmarks Game is under their Revised BSD

Other code in this repo is under MIT.

About

Yet another implementation of computer language benchmarks game

https://programming-language-benchmarks.vercel.app/

License:MIT License


Languages

Language:C# 14.8%Language:Rust 13.4%Language:Common Lisp 9.3%Language:Zig 4.7%Language:D 4.5%Language:Java 3.9%Language:C 3.5%Language:Go 3.4%Language:Python 2.9%Language:TypeScript 2.9%Language:Kotlin 2.8%Language:Dart 2.7%Language:OCaml 2.5%Language:Julia 2.4%Language:Chapel 2.3%Language:Crystal 2.2%Language:C++ 2.2%Language:JavaScript 2.1%Language:Nim 2.0%Language:Odin 2.0%Language:Vue 1.7%Language:Haxe 1.5%Language:V 1.5%Language:Swift 1.5%Language:Racket 1.3%Language:Fortran 1.3%Language:Ruby 1.2%Language:Perl 0.7%Language:Pony 0.6%Language:Lua 0.5%Language:Wren 0.5%Language:Elixir 0.4%Language:Hack 0.3%Language:PHP 0.2%Language:Haskell 0.2%Language:SCSS 0.0%Language:Shell 0.0%Language:HTML 0.0%