diff options
| author | Tyge Lovset <[email protected]> | 2023-04-07 13:33:06 +0200 |
|---|---|---|
| committer | Tyge Lovset <[email protected]> | 2023-04-07 13:33:06 +0200 |
| commit | 13eb85e05a88633454df7b62b80737fcc9d12238 (patch) | |
| tree | 302886fb464409ba5633ffebfcf7186c4671e336 /misc/benchmarks/plotbench | |
| parent | 2ad41420a973a3f1bd1ca47ab0f61b8f59ab9e66 (diff) | |
| download | STC-modified-13eb85e05a88633454df7b62b80737fcc9d12238.tar.gz STC-modified-13eb85e05a88633454df7b62b80737fcc9d12238.zip | |
Massive documentation update/improvements.
Reduced benchmarks/plotbench repetition/sizes.
Diffstat (limited to 'misc/benchmarks/plotbench')
| -rw-r--r-- | misc/benchmarks/plotbench/cdeq_benchmark.cpp | 4 | ||||
| -rw-r--r-- | misc/benchmarks/plotbench/clist_benchmark.cpp | 4 | ||||
| -rw-r--r-- | misc/benchmarks/plotbench/cmap_benchmark.cpp | 6 | ||||
| -rw-r--r-- | misc/benchmarks/plotbench/cpque_benchmark.cpp | 4 | ||||
| -rw-r--r-- | misc/benchmarks/plotbench/csmap_benchmark.cpp | 4 | ||||
| -rw-r--r-- | misc/benchmarks/plotbench/cvec_benchmark.cpp | 2 | ||||
| -rw-r--r-- | misc/benchmarks/plotbench/plot.py | 2 | ||||
| -rw-r--r-- | misc/benchmarks/plotbench/run_all.bat | 4 | ||||
| -rw-r--r-- | misc/benchmarks/plotbench/run_clang.sh | 2 | ||||
| -rw-r--r-- | misc/benchmarks/plotbench/run_gcc.sh | 4 | ||||
| -rw-r--r-- | misc/benchmarks/plotbench/run_vc.bat | 3 |
11 files changed, 21 insertions, 18 deletions
diff --git a/misc/benchmarks/plotbench/cdeq_benchmark.cpp b/misc/benchmarks/plotbench/cdeq_benchmark.cpp index a8399ea8..bb0e28c8 100644 --- a/misc/benchmarks/plotbench/cdeq_benchmark.cpp +++ b/misc/benchmarks/plotbench/cdeq_benchmark.cpp @@ -12,7 +12,7 @@ enum {INSERT, ERASE, FIND, ITER, DESTRUCT, N_TESTS}; const char* operations[] = {"insert", "erase", "find", "iter", "destruct"}; typedef struct { time_t t1, t2; uint64_t sum; float fac; } Range; typedef struct { const char* name; Range test[N_TESTS]; } Sample; -enum {SAMPLES = 2, N = 100000000, S = 0x3ffc, R = 4}; +enum {SAMPLES = 2, N = 50000000, S = 0x3ffc, R = 4}; uint64_t seed = 1, mask1 = 0xfffffff, mask2 = 0xffff; static float secs(Range s) { return (float)(s.t2 - s.t1) / CLOCKS_PER_SEC; } @@ -122,7 +122,7 @@ int main(int argc, char* argv[]) bool header = (argc > 2 && argv[2][0] == '1'); float std_sum = 0, stc_sum = 0; - c_forrange (j, N_TESTS) { + c_forrange (j, N_TESTS) { std_sum += secs(std_s[0].test[j]); stc_sum += secs(stc_s[0].test[j]); } diff --git a/misc/benchmarks/plotbench/clist_benchmark.cpp b/misc/benchmarks/plotbench/clist_benchmark.cpp index 46bd2793..01bfbf83 100644 --- a/misc/benchmarks/plotbench/clist_benchmark.cpp +++ b/misc/benchmarks/plotbench/clist_benchmark.cpp @@ -12,7 +12,7 @@ enum {INSERT, ERASE, FIND, ITER, DESTRUCT, N_TESTS}; const char* operations[] = {"insert", "erase", "find", "iter", "destruct"}; typedef struct { time_t t1, t2; uint64_t sum; float fac; } Range; typedef struct { const char* name; Range test[N_TESTS]; } Sample; -enum {SAMPLES = 2, N = 50000000, S = 0x3ffc, R = 4}; +enum {SAMPLES = 2, N = 10000000, S = 0x3ffc, R = 4}; uint64_t seed = 1, mask1 = 0xfffffff, mask2 = 0xffff; static float secs(Range s) { return (float)(s.t2 - s.t1) / CLOCKS_PER_SEC; } @@ -132,4 +132,4 @@ int main(int argc, char* argv[]) c_forrange (j, N_TESTS) printf("%s,%s n:%d,%s,%.3f,%.3f\n", comp, stc_s[0].name, N, operations[j], secs(stc_s[0].test[j]), secs(std_s[0].test[j]) ? secs(stc_s[0].test[j])/secs(std_s[0].test[j]) : 1.0f); printf("%s,%s n:%d,%s,%.3f,%.3f\n", comp, stc_s[0].name, N, "total", stc_sum, stc_sum/std_sum); -}
\ No newline at end of file +} diff --git a/misc/benchmarks/plotbench/cmap_benchmark.cpp b/misc/benchmarks/plotbench/cmap_benchmark.cpp index 0582d162..6b2edbd7 100644 --- a/misc/benchmarks/plotbench/cmap_benchmark.cpp +++ b/misc/benchmarks/plotbench/cmap_benchmark.cpp @@ -11,7 +11,7 @@ enum {INSERT, ERASE, FIND, ITER, DESTRUCT, N_TESTS}; const char* operations[] = {"insert", "erase", "find", "iter", "destruct"}; typedef struct { time_t t1, t2; uint64_t sum; float fac; } Range; typedef struct { const char* name; Range test[N_TESTS]; } Sample; -enum {SAMPLES = 2, N = 8000000, R = 4}; +enum {SAMPLES = 2, N = 2000000, R = 4}; uint64_t seed = 1, mask1 = 0xffffffff; static float secs(Range s) { return (float)(s.t2 - s.t1) / CLOCKS_PER_SEC; } @@ -92,7 +92,7 @@ Sample test_stc_unordered_map() { s.test[FIND].t1 = clock(); size_t sum = 0; const cmap_x_value* val; - c_forrange (N) + c_forrange (N) if ((val = cmap_x_get(&con, crand() & mask1))) sum += val->second; s.test[FIND].t2 = clock(); @@ -139,4 +139,4 @@ int main(int argc, char* argv[]) c_forrange (j, N_TESTS) printf("%s,%s n:%d,%s,%.3f,%.3f\n", comp, stc_s[0].name, N, operations[j], secs(stc_s[0].test[j]), secs(std_s[0].test[j]) ? secs(stc_s[0].test[j])/secs(std_s[0].test[j]) : 1.0f); printf("%s,%s n:%d,%s,%.3f,%.3f\n", comp, stc_s[0].name, N, "total", stc_sum, stc_sum/std_sum); -}
\ No newline at end of file +} diff --git a/misc/benchmarks/plotbench/cpque_benchmark.cpp b/misc/benchmarks/plotbench/cpque_benchmark.cpp index da092b7f..2d4c7a28 100644 --- a/misc/benchmarks/plotbench/cpque_benchmark.cpp +++ b/misc/benchmarks/plotbench/cpque_benchmark.cpp @@ -11,7 +11,7 @@ #include <queue> static const uint32_t seed = 1234; -static const int N = 10000000; +static const int N = 2500000; void std_test() { @@ -47,7 +47,7 @@ void stc_test() printf("Built priority queue: %f secs\n", (float)(clock() - start)/(float)CLOCKS_PER_SEC); printf("%g ", *cpque_f_top(&pq)); - + start = clock(); c_forrange (i, N) { cpque_f_pop(&pq); diff --git a/misc/benchmarks/plotbench/csmap_benchmark.cpp b/misc/benchmarks/plotbench/csmap_benchmark.cpp index da3fc9cc..60f2db49 100644 --- a/misc/benchmarks/plotbench/csmap_benchmark.cpp +++ b/misc/benchmarks/plotbench/csmap_benchmark.cpp @@ -11,7 +11,7 @@ enum {INSERT, ERASE, FIND, ITER, DESTRUCT, N_TESTS}; const char* operations[] = {"insert", "erase", "find", "iter", "destruct"}; typedef struct { time_t t1, t2; uint64_t sum; float fac; } Range; typedef struct { const char* name; Range test[N_TESTS]; } Sample; -enum {SAMPLES = 2, N = 4000000, R = 4}; +enum {SAMPLES = 2, N = 1000000, R = 4}; uint64_t seed = 1, mask1 = 0xfffffff; static float secs(Range s) { return (float)(s.t2 - s.t1) / CLOCKS_PER_SEC; } @@ -93,7 +93,7 @@ Sample test_stc_map() { s.test[FIND].t1 = clock(); size_t sum = 0; const csmap_x_value* val; - c_forrange (N) + c_forrange (N) if ((val = csmap_x_get(&con, crand() & mask1))) sum += val->second; s.test[FIND].t2 = clock(); diff --git a/misc/benchmarks/plotbench/cvec_benchmark.cpp b/misc/benchmarks/plotbench/cvec_benchmark.cpp index b605f4e6..c488a01c 100644 --- a/misc/benchmarks/plotbench/cvec_benchmark.cpp +++ b/misc/benchmarks/plotbench/cvec_benchmark.cpp @@ -12,7 +12,7 @@ enum {INSERT, ERASE, FIND, ITER, DESTRUCT, N_TESTS}; const char* operations[] = {"insert", "erase", "find", "iter", "destruct"}; typedef struct { time_t t1, t2; uint64_t sum; float fac; } Range; typedef struct { const char* name; Range test[N_TESTS]; } Sample; -enum {SAMPLES = 2, N = 150000000, S = 0x3ffc, R = 4}; +enum {SAMPLES = 2, N = 80000000, S = 0x3ffc, R = 4}; uint64_t seed = 1, mask1 = 0xfffffff, mask2 = 0xffff; static float secs(Range s) { return (float)(s.t2 - s.t1) / CLOCKS_PER_SEC; } diff --git a/misc/benchmarks/plotbench/plot.py b/misc/benchmarks/plotbench/plot.py index fa538285..0ba92264 100644 --- a/misc/benchmarks/plotbench/plot.py +++ b/misc/benchmarks/plotbench/plot.py @@ -4,7 +4,7 @@ import pandas as pd import matplotlib.pyplot as plt #sns.set_theme(style="whitegrid") -comp = ['All compilers', 'Mingw-g++-10.30', 'Win-Clang-12', 'VC-19.28'] +comp = ['All compilers', 'Mingw-g++-11.3.0', 'Win-Clang-14.0.1', 'VC-19.28'] n = int(sys.argv[1]) if len(sys.argv) > 1 else 0 file = sys.argv[2] if len(sys.argv) > 2 else 'plot_win.csv' df = pd.read_csv(file) diff --git a/misc/benchmarks/plotbench/run_all.bat b/misc/benchmarks/plotbench/run_all.bat index 2edd0a1e..98913a50 100644 --- a/misc/benchmarks/plotbench/run_all.bat +++ b/misc/benchmarks/plotbench/run_all.bat @@ -1,5 +1,7 @@ set out=plot_win.csv echo Compiler,Library,C,Method,Seconds,Ratio> %out% +echo gcc sh run_gcc.sh >> %out% +echo clang sh run_clang.sh >> %out% -call run_vc.bat >> %out% +REM call run_vc.bat >> %out% diff --git a/misc/benchmarks/plotbench/run_clang.sh b/misc/benchmarks/plotbench/run_clang.sh index ae19486e..096e71be 100644 --- a/misc/benchmarks/plotbench/run_clang.sh +++ b/misc/benchmarks/plotbench/run_clang.sh @@ -6,7 +6,7 @@ clang++ -I../include -O3 -o cmap_benchmark$exe cmap_benchmark.cpp clang++ -I../include -O3 -o csmap_benchmark$exe csmap_benchmark.cpp clang++ -I../include -O3 -o cvec_benchmark$exe cvec_benchmark.cpp -c='Win-Clang-12' +c='Win-Clang-14.0.1' ./cdeq_benchmark$exe $c ./clist_benchmark$exe $c ./cmap_benchmark$exe $c diff --git a/misc/benchmarks/plotbench/run_gcc.sh b/misc/benchmarks/plotbench/run_gcc.sh index 6a6472c0..5249ed1e 100644 --- a/misc/benchmarks/plotbench/run_gcc.sh +++ b/misc/benchmarks/plotbench/run_gcc.sh @@ -4,9 +4,9 @@ g++ -I../include -O3 -o cmap_benchmark cmap_benchmark.cpp g++ -I../include -O3 -o csmap_benchmark csmap_benchmark.cpp g++ -I../include -O3 -o cvec_benchmark cvec_benchmark.cpp -c='Mingw-g++-10.30' +c='Mingw-g++-11.3.0' ./cdeq_benchmark $c ./clist_benchmark $c ./cmap_benchmark $c ./csmap_benchmark $c -./cvec_benchmark $c
\ No newline at end of file +./cvec_benchmark $c diff --git a/misc/benchmarks/plotbench/run_vc.bat b/misc/benchmarks/plotbench/run_vc.bat index 3dca925b..dc4938f8 100644 --- a/misc/benchmarks/plotbench/run_vc.bat +++ b/misc/benchmarks/plotbench/run_vc.bat @@ -1,3 +1,4 @@ + @echo off if "%VSINSTALLDIR%"=="" call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat" >nul cl.exe -nologo -EHsc -std:c++latest -I../include -O2 cdeq_benchmark.cpp >nul @@ -12,4 +13,4 @@ cdeq_benchmark.exe %c% clist_benchmark.exe %c% cmap_benchmark.exe %c% csmap_benchmark.exe %c% -cvec_benchmark.exe %c%
\ No newline at end of file +cvec_benchmark.exe %c% |
