diff options
| author | Tyge Løvset <[email protected]> | 2021-09-19 13:49:41 +0200 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2021-09-19 13:49:41 +0200 |
| commit | 8da81e7a625f06ec667793ff624c6876d03abbde (patch) | |
| tree | f1c09759a45b42fdff374b9bde009a9356dffe29 /benchmarks | |
| parent | 58b2831a7287cb00d14a221a9d0263fb0c427675 (diff) | |
| download | STC-modified-8da81e7a625f06ec667793ff624c6876d03abbde.tar.gz STC-modified-8da81e7a625f06ec667793ff624c6876d03abbde.zip | |
Fixed errors caused by gcc -std=c99 -pedantic.
Diffstat (limited to 'benchmarks')
| -rw-r--r-- | benchmarks/build_all.sh | 35 | ||||
| -rw-r--r-- | benchmarks/cpque_benchmark.cpp | 4 | ||||
| -rw-r--r-- | benchmarks/run_clang.sh | 24 | ||||
| -rw-r--r-- | benchmarks/run_gcc.sh | 22 | ||||
| -rw-r--r-- | benchmarks/shootout1_cmap.cpp | 7 | ||||
| -rw-r--r-- | benchmarks/shootout2_cmap.cpp | 13 | ||||
| -rw-r--r-- | benchmarks/shootout5_crand.cpp | 8 |
7 files changed, 65 insertions, 48 deletions
diff --git a/benchmarks/build_all.sh b/benchmarks/build_all.sh new file mode 100644 index 00000000..6217d5e1 --- /dev/null +++ b/benchmarks/build_all.sh @@ -0,0 +1,35 @@ +#!/bin/sh +cc='g++ -std=c++17' +#cc='clang' +#cc='clang -c -DSTC_HEADER' +#cc='cl -nologo' +#cc='cl -nologo -TP' +#cc='cl -nologo -std:c11' +run=0 +if [ "$1" == '-h' -o "$1" == '--help' ]; then + echo usage: runall.sh [-run] [compiler + options] + exit +fi +if [ "$1" == '-run' ]; then + run=1 + shift +fi +if [ ! -z "$1" ] ; then + cc=$@ +fi +if [ $run = 0 ] ; then + for i in *.cpp ; do + echo $cc -I../include $i + $cc -I../include $i + done +else + for i in *.c ; do + echo $cc -I../include $i + $cc -I../include $i + if [ -f $(basename -s .c $i).exe ]; then ./$(basename -s .c $i).exe; fi + if [ -f ./a.exe ]; then ./a.exe; fi + if [ -f ./a.out ]; then ./a.out; fi + done +fi + +rm -f a.out *.o *.obj *.exe diff --git a/benchmarks/cpque_benchmark.cpp b/benchmarks/cpque_benchmark.cpp index 2b6445c5..5f7dd364 100644 --- a/benchmarks/cpque_benchmark.cpp +++ b/benchmarks/cpque_benchmark.cpp @@ -2,7 +2,7 @@ #include <time.h>
#include <stc/crandom.h>
-#define i_tag x
+#define i_tag f
#define i_val float
#define i_cmp -c_default_compare
#include <stc/cpque.h>
@@ -18,7 +18,7 @@ int main() rng = stc64_init(seed);
clock_t start = clock();
c_forrange (i, int, N)
- cvec_f_push_back(&pq, (float) stc64_randf(&rng)*100000);
+ cpque_f_push_back(&pq, (float) stc64_randf(&rng)*100000);
cpque_f_make_heap(&pq);
printf("Built priority queue: %f secs\n", (clock() - start) / (float) CLOCKS_PER_SEC);
diff --git a/benchmarks/run_clang.sh b/benchmarks/run_clang.sh index e8e9910f..f7575882 100644 --- a/benchmarks/run_clang.sh +++ b/benchmarks/run_clang.sh @@ -1,12 +1,14 @@ -clang++ -I../include -O3 -o cdeq_benchmark.exe cdeq_benchmark.cpp -clang++ -I../include -O3 -o clist_benchmark.exe clist_benchmark.cpp -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 +exe='' +if [ "$OS" == 'Windows_NT' ]; then exe='.exe'; fi +clang++ -I../include -O3 -o cdeq_benchmark$exe cdeq_benchmark.cpp +clang++ -I../include -O3 -o clist_benchmark$exe clist_benchmark.cpp +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 -./cdeq_benchmark.exe $c -./clist_benchmark.exe $c -./cmap_benchmark.exe $c -./csmap_benchmark.exe $c -./cvec_benchmark.exe $c +c='Win-Clang-12' +./cdeq_benchmark$exe $c +./clist_benchmark$exe $c +./cmap_benchmark$exe $c +./csmap_benchmark$exe $c +./cvec_benchmark$exe $c diff --git a/benchmarks/run_gcc.sh b/benchmarks/run_gcc.sh index 460afe16..6a6472c0 100644 --- a/benchmarks/run_gcc.sh +++ b/benchmarks/run_gcc.sh @@ -1,12 +1,12 @@ -g++ -I../include -O3 -o cdeq_benchmark.exe cdeq_benchmark.cpp -g++ -I../include -O3 -o clist_benchmark.exe clist_benchmark.cpp -g++ -I../include -O3 -o cmap_benchmark.exe cmap_benchmark.cpp -g++ -I../include -O3 -o csmap_benchmark.exe csmap_benchmark.cpp -g++ -I../include -O3 -o cvec_benchmark.exe cvec_benchmark.cpp +g++ -I../include -O3 -o cdeq_benchmark cdeq_benchmark.cpp +g++ -I../include -O3 -o clist_benchmark clist_benchmark.cpp +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 -./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 +c='Mingw-g++-10.30' +./cdeq_benchmark $c +./clist_benchmark $c +./cmap_benchmark $c +./csmap_benchmark $c +./cvec_benchmark $c
\ No newline at end of file diff --git a/benchmarks/shootout1_cmap.cpp b/benchmarks/shootout1_cmap.cpp index 5fd32586..2cdb919f 100644 --- a/benchmarks/shootout1_cmap.cpp +++ b/benchmarks/shootout1_cmap.cpp @@ -7,7 +7,6 @@ #include "others/robin_hood.hpp"
#include "others/skarupke/bytell_hash_map.hpp"
#include "others/tsl/hopscotch_map.h"
-#include "others/tsl/robin_map.h"
#include "others/sparsepp/spp.h"
#define PICOBENCH_IMPLEMENT_WITH_MAIN
@@ -20,7 +19,6 @@ template <class K, class V> using umap = std::unordered_map<K, V>; template <class K, class V> using bmap = ska::bytell_hash_map<K, V>;
template <class K, class V> using fmap = ska::flat_hash_map<K, V>;
template <class K, class V> using hmap = tsl::hopscotch_map<K, V>;
-template <class K, class V> using omap = tsl::robin_map<K, V>;
template <class K, class V> using smap = spp::sparse_hash_map<K, V>;
template <class K, class V> using rmap = robin_hood::unordered_flat_map<K, V, robin_hood::hash<K>,
std::equal_to<K>, MaxLoadFactor100>;
@@ -29,7 +27,6 @@ template <class K, class V> using rmap = robin_hood::unordered_flat_map<K, V, ro using b##map = bmap __VA_ARGS__; \
using f##map = fmap __VA_ARGS__; \
using h##map = hmap __VA_ARGS__; \
- using o##map = omap __VA_ARGS__; \
using s##map = smap __VA_ARGS__; \
using r##map = rmap __VA_ARGS__
@@ -122,7 +119,6 @@ PICOBENCH(ins_and_erase_i<umap_x>).P; PICOBENCH(ins_and_erase_i<bmap_x>).P;
PICOBENCH(ins_and_erase_i<fmap_x>).P;
PICOBENCH(ins_and_erase_i<hmap_x>).P;
-PICOBENCH(ins_and_erase_i<omap_x>).P;
PICOBENCH(ins_and_erase_i<smap_x>).P;
PICOBENCH(ins_and_erase_i<rmap_x>).P;
PICOBENCH(ins_and_erase_cmap_x).P;
@@ -165,7 +161,6 @@ PICOBENCH(ins_and_access_i<umap_i>).P; PICOBENCH(ins_and_access_i<bmap_i>).P;
PICOBENCH(ins_and_access_i<fmap_i>).P;
PICOBENCH(ins_and_access_i<hmap_i>).P;
-PICOBENCH(ins_and_access_i<omap_i>).P;
PICOBENCH(ins_and_access_i<smap_i>).P;
PICOBENCH(ins_and_access_i<rmap_i>).P;
PICOBENCH(ins_and_access_cmap_i).P;
@@ -223,7 +218,6 @@ PICOBENCH(ins_and_access_s<umap_s>).P; PICOBENCH(ins_and_access_s<bmap_s>).P;
PICOBENCH(ins_and_access_s<fmap_s>).P;
PICOBENCH(ins_and_access_s<hmap_s>).P;
-PICOBENCH(ins_and_access_s<omap_s>).P;
PICOBENCH(ins_and_access_s<smap_s>).P;
PICOBENCH(ins_and_access_s<rmap_s>).P;
PICOBENCH(ins_and_access_cmap_s).P;
@@ -297,7 +291,6 @@ PICOBENCH(iterate_x<umap_x>).P; PICOBENCH(iterate_x<bmap_x>).P;
PICOBENCH(iterate_x<fmap_x>).P;
PICOBENCH(iterate_x<hmap_x>).P;
-PICOBENCH(iterate_x<omap_x>).P;
PICOBENCH(iterate_x<smap_x>).P;
PICOBENCH(iterate_x<rmap_x>).P;
PICOBENCH(iterate_cmap_x).P;
diff --git a/benchmarks/shootout2_cmap.cpp b/benchmarks/shootout2_cmap.cpp index 669c336c..6224c1f3 100644 --- a/benchmarks/shootout2_cmap.cpp +++ b/benchmarks/shootout2_cmap.cpp @@ -9,7 +9,6 @@ #include "others/robin_hood.hpp"
#include "others/skarupke/bytell_hash_map.hpp"
#include "others/tsl/hopscotch_map.h"
-#include "others/tsl/robin_map.h"
#include "others/sparsepp/spp.h"
template<typename C> inline void destroy_me(C& c) { C().swap(c); }
#endif
@@ -105,18 +104,6 @@ stc64_t rng; #define HMAP_CLEAR(X) UMAP_CLEAR(X)
#define HMAP_DTOR(X) UMAP_DTOR(X)
-#define OMAP_SETUP(X, Key, Value) tsl::robin_map<Key, Value> map; map.max_load_factor(max_load_factor)
-#define OMAP_PUT(X, key, val) UMAP_PUT(X, key, val)
-#define OMAP_EMPLACE(X, key, val) UMAP_EMPLACE(X, key, val)
-#define OMAP_FIND(X, key) UMAP_FIND(X, key)
-#define OMAP_ERASE(X, key) UMAP_ERASE(X, key)
-#define OMAP_FOR(X, i) UMAP_FOR(X, i)
-#define OMAP_ITEM(X, i) UMAP_ITEM(X, i)
-#define OMAP_SIZE(X) UMAP_SIZE(X)
-#define OMAP_BUCKETS(X) UMAP_BUCKETS(X)
-#define OMAP_CLEAR(X) UMAP_CLEAR(X)
-#define OMAP_DTOR(X) UMAP_DTOR(X)
-
#define RMAP_SETUP(X, Key, Value) robin_hood::unordered_map<Key, Value> map
#define RMAP_PUT(X, key, val) UMAP_PUT(X, key, val)
#define RMAP_EMPLACE(X, key, val) UMAP_EMPLACE(X, key, val)
diff --git a/benchmarks/shootout5_crand.cpp b/benchmarks/shootout5_crand.cpp index eacca54a..0a034fc4 100644 --- a/benchmarks/shootout5_crand.cpp +++ b/benchmarks/shootout5_crand.cpp @@ -2,7 +2,7 @@ #include <time.h>
#include <random>
#include "stc/crandom.h"
-#include "others/pcg_random.hpp"
+//#include "pcg_random.hpp"
static struct stc32_state { stc64_t rng; uint64_t spare; unsigned n; } stc32_global =
{{0x7a5fed, 0x8e3f52, 0x9bc713, 0x6a09e667a7541669}, 0, 0};
@@ -59,7 +59,7 @@ void test1(void) c_forrange (8) printf("%f ", fdist(rng));
puts("\n");
}
-
+/*
void test2()
{
clock_t diff, before;
@@ -96,7 +96,7 @@ void test2() c_forrange (8) printf("%f ", fdist(rng));
puts("\n");
}
-
+*/
void test3(void)
{
@@ -132,6 +132,6 @@ void test3(void) int main()
{
test1();
- test2();
+ //test2();
test3();
}
\ No newline at end of file |
