Problem: #21 Amicable Numbers Benchmark using C, Go, Haskell and Rust
Description:
This is a benchmark between C
, Go
, Haskell
, and Rust
. Rust
allows for different forms of implementation using stdlib
so there are multiple implementations.
Source codes were taken from this thread.
It is just a hobby project to perform benchmark.
Contribution guidelines:
- If you want to suggest flaws with this benchmark, you can open issues.
- If you want to change algorithm, you have to change the algorithm in all the languages.
Notes:
- Here the focus is on similar algorithm rather than the most efficient one
- C compilation params:
gcc -Wall -Wextra -std=c99 -Ofast -flto -s c99.c -o c99
- The rust exe was built with
rustc -O <file>
- Go compilation command:
go build -ldflags "-s -w" goloop.go
.-ldflags "-s -w"
removes debug symbols. - Haskell was built with
ghc -O2 -optl-s hsiter.hs
bench.txt
is the output after runningrun.cmd
.Hyperfine
was used to run benchmarks.