Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixup compile commands, add makefile #3

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

alerque
Copy link

@alerque alerque commented Jul 2, 2024

A few of the compile commands in the readme don't actually produce the names expected (rather a.out), and the zig ones clobber each-other. These commands should fix that up. It also adds a Makefile for convenience that can run any or all of the builds automatically. Lastly there is a target that uses hyperfine to actually run the benchmarks in a much more useful way that includes multiple passes of each to avoid system jitter, bad results from some other process that happened to interfere more with one run than another, etc. It also does a bunch of the math to show you relative results.

For example to build everything and then benchmark them all with 2 runs each:

$ make benchmark RUNS=2

@alerque
Copy link
Author

alerque commented Jul 3, 2024

Also my results are in line with the other findings that at the end of the day these benchmarks are only LLVM vs. LLVM. Here are my results:

$ make benchmark
hyperfine -r3 ./c++ ./rust ./zig-safe ./zig-fast ./c
Benchmark 1: ./c++
  Time (mean ± σ):     91.620 s ±  0.292 s    [User: 91.401 s, System: 0.004 s]
  Range (min … max):   91.452 s … 91.958 s    3 runs

Benchmark 2: ./rust
  Time (mean ± σ):     91.305 s ±  0.794 s    [User: 91.174 s, System: 0.003 s]
  Range (min … max):   90.391 s … 91.817 s    3 runs

Benchmark 3: ./zig-safe
  Time (mean ± σ):     96.339 s ±  0.340 s    [User: 96.199 s, System: 0.004 s]
  Range (min … max):   95.946 s … 96.548 s    3 runs

Benchmark 4: ./zig-fast
  Time (mean ± σ):     91.635 s ±  0.132 s    [User: 91.472 s, System: 0.022 s]
  Range (min … max):   91.486 s … 91.738 s    3 runs

Benchmark 5: ./c
  Time (mean ± σ):     92.418 s ±  0.180 s    [User: 92.137 s, System: 0.031 s]
  Range (min … max):   92.210 s … 92.531 s    3 runs

Summary
  ./rust ran
    1.00 ± 0.01 times faster than ./c++
    1.00 ± 0.01 times faster than ./zig-fast
    1.01 ± 0.01 times faster than ./c
    1.06 ± 0.01 times faster than ./zig-safe

$ neofetch --stdout
OS: Arch Linux x86_64
Kernel: 6.9.7-arch1-1
CPU: AMD Ryzen 5 3600 (12) @ 3.600GHz
GPU: AMD ATI Radeon RX 5500/5500M / Pro 5500M
Memory: 10416MiB / 64224MiB

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant