https://github.com/stan-dev/perf-math
https://github.com/stan-dev/perf-math
Last synced: 9 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/stan-dev/perf-math
- Owner: stan-dev
- Created: 2018-08-29T08:50:14.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-06-02T19:35:39.000Z (over 2 years ago)
- Last Synced: 2024-10-29T14:21:57.090Z (about 1 year ago)
- Language: C++
- Size: 1.55 MB
- Stars: 7
- Watchers: 5
- Forks: 5
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Getting started
```
git clone --recursive --shallow-submodules https://github.com/seantalts/perf-math.git
```
### First run
(unless you have the Google benchmark library installed)
```
cd benchmark
git clone --depth=1 https://github.com/google/googletest
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=RELEASE
make
```
## Writing a benchmark
There is an example, this matstuff.cpp. You can make your own or reuse this
file. See https://github.com/google/benchmark for details.
Essential structure:
```cpp
static void BM_Name(benchmark::State& state) {
setup();
for (auto _ : state) {
thing_to_time();
}
}
BENCHMARK(BM_Name);
BENCHMARK_MAIN();
```
## Making a benchmark
```
$ make matstuff && ./matstuff
c++ -Imath/lib/eigen_3.3.3/ -Ibenchmark/include -std=c++1y -Imath/
-Imath/lib/boost_1.66.0 -Lbenchmark/build/src matstuff.cpp -lbenchmark -o
matstuff
2018-08-29 04:52:47
Running ./matstuff
Run on (4 X 2200 MHz CPU s)
CPU Caches:
L1 Data 32K (x2)
L1 Instruction 32K (x2)
L2 Unified 262K (x2)
L3 Unified 4194K (x1)
------------------------------------------------------
Benchmark Time CPU Iterations
------------------------------------------------------
BM_LogOrig 2688940713 ns 2669717000 ns 1
BM_LogProposed 2711084835 ns 2696761000 ns 1
```