Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/smasher164/eval_bench
Compare switch case, computed goto, and regular goto + local switch in benchmark.
https://github.com/smasher164/eval_bench
Last synced: about 2 months ago
JSON representation
Compare switch case, computed goto, and regular goto + local switch in benchmark.
- Host: GitHub
- URL: https://github.com/smasher164/eval_bench
- Owner: smasher164
- License: mit
- Created: 2024-01-11T08:47:00.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2024-01-11T13:03:11.000Z (12 months ago)
- Last Synced: 2024-01-12T21:27:10.206Z (12 months ago)
- Language: C++
- Homepage:
- Size: 15.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# goto eval benchmark
Compare switch case, computed goto, tail calls, and regular goto + local switch
in benchmark. Compiled with `gcc` and `-O3` for my machine
(`11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz`/`4 cores`/`64gb ram`).```
g++ -o eval_bench -O3 main.cpp
```
Ran `100` iterations with 5 samples.
```
$ ./eval_bench --iters=100 --samples=5
===============================================================================
Name (* = baseline) | Dim | Total ms | ns/op |Baseline| Ops/second
===============================================================================
bench_interp_switch * | 100 | 58.306 | 583062 | - | 1715.1
bench_interp_cgoto | 100 | 51.521 | 515209 | 0.884 | 1941.0
bench_interp_goto | 100 | 59.076 | 590755 | 1.013 | 1692.7
bench_interp_tailcall | 100 | 59.049 | 590487 | 1.013 | 1693.5
===============================================================================Not sure why the tailcall version isn't faster than baseline.