summaryrefslogtreecommitdiffhomepage
path: root/misc
diff options
context:
space:
mode:
authortylov <[email protected]>2023-07-12 12:38:40 +0200
committertylov <[email protected]>2023-07-12 13:56:06 +0200
commit50cbc73d4fef3ce91d094b80a018769eac439965 (patch)
tree79492e482cf232ed4def920c015c5f86f030f295 /misc
parent0bcb0fcd981cb15329dfd4fb675097564164da18 (diff)
downloadSTC-modified-50cbc73d4fef3ce91d094b80a018769eac439965.tar.gz
STC-modified-50cbc73d4fef3ce91d094b80a018769eac439965.zip
template.h: i_valclone and i_valfrom are considered the same when only one is defined and i_valraw is not defined (directly or via valclass/valboxed/val_str). Also applies to key. Some adjustments for benchmarking.
Diffstat (limited to 'misc')
-rw-r--r--misc/benchmarks/plotbench/clist_benchmark.cpp2
-rw-r--r--misc/benchmarks/plotbench/run_clang.sh10
-rw-r--r--misc/benchmarks/plotbench/run_gcc.sh10
-rw-r--r--misc/examples/new_list.c5
4 files changed, 14 insertions, 13 deletions
diff --git a/misc/benchmarks/plotbench/clist_benchmark.cpp b/misc/benchmarks/plotbench/clist_benchmark.cpp
index 703222b3..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 = 25000000, 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; }
diff --git a/misc/benchmarks/plotbench/run_clang.sh b/misc/benchmarks/plotbench/run_clang.sh
index c9dbac31..59d577d9 100644
--- a/misc/benchmarks/plotbench/run_clang.sh
+++ b/misc/benchmarks/plotbench/run_clang.sh
@@ -1,10 +1,10 @@
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
+clang++ -DNDEBUG -I../../include -O3 -o cdeq_benchmark$exe cdeq_benchmark.cpp
+clang++ -DNDEBUG -I../../include -O3 -o clist_benchmark$exe clist_benchmark.cpp
+clang++ -DNDEBUG -I../../include -O3 -o cmap_benchmark$exe cmap_benchmark.cpp
+clang++ -DNDEBUG -I../../include -O3 -o csmap_benchmark$exe csmap_benchmark.cpp
+clang++ -DNDEBUG -I../../include -O3 -o cvec_benchmark$exe cvec_benchmark.cpp
c='Win-Clang-14.0.1'
./cdeq_benchmark$exe $c
diff --git a/misc/benchmarks/plotbench/run_gcc.sh b/misc/benchmarks/plotbench/run_gcc.sh
index 14d89b9a..73b979d3 100644
--- a/misc/benchmarks/plotbench/run_gcc.sh
+++ b/misc/benchmarks/plotbench/run_gcc.sh
@@ -1,8 +1,8 @@
-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
+g++ -DNDEBUG -I../../include -O3 -o cdeq_benchmark cdeq_benchmark.cpp
+g++ -DNDEBUG -I../../include -O3 -o clist_benchmark clist_benchmark.cpp
+g++ -DNDEBUG -I../../include -O3 -o cmap_benchmark cmap_benchmark.cpp
+g++ -DNDEBUG -I../../include -O3 -o csmap_benchmark csmap_benchmark.cpp
+g++ -DNDEBUG -I../../include -O3 -o cvec_benchmark cvec_benchmark.cpp
c='Mingw-g++-11.3.0'
./cdeq_benchmark $c
diff --git a/misc/examples/new_list.c b/misc/examples/new_list.c
index 8083c315..5ffdaca2 100644
--- a/misc/examples/new_list.c
+++ b/misc/examples/new_list.c
@@ -32,8 +32,9 @@ int point_cmp(const Point* a, const Point* b) {
void MyStruct_drop(MyStruct* s);
#define i_type MyList
-#define i_valclass MyStruct // MyStruct contains "class"-types, so define as "class"
-#define i_opt c_no_clone|c_no_cmp // exclude cloning and comparison support
+#define i_val MyStruct
+#define i_valdrop MyStruct_drop // define drop function
+#define i_no_clone // must explicitely exclude or define cloning support because of drop.
#include <stc/clist.h>
void MyStruct_drop(MyStruct* s) {