diff options
| author | Tyge Løvset <[email protected]> | 2021-02-11 23:13:19 +0100 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2021-02-11 23:13:19 +0100 |
| commit | 6427626639f37c142b225c998888dfbe9be1328c (patch) | |
| tree | e90383fb10d1b282ec98e1a96286c0b675d68d63 /benchmarks/cmap_benchmark.cpp | |
| parent | e6ea4740c9fad4a9453fb62432ef238d2761271c (diff) | |
| download | STC-modified-6427626639f37c142b225c998888dfbe9be1328c.tar.gz STC-modified-6427626639f37c142b225c998888dfbe9be1328c.zip | |
Updated benchmarks, README, two minor API fixes.
Diffstat (limited to 'benchmarks/cmap_benchmark.cpp')
| -rw-r--r-- | benchmarks/cmap_benchmark.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/benchmarks/cmap_benchmark.cpp b/benchmarks/cmap_benchmark.cpp index d9cb1722..56c92264 100644 --- a/benchmarks/cmap_benchmark.cpp +++ b/benchmarks/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};
+enum {SAMPLES = 2, N = 8000000, R = 4};
uint64_t seed = 1, mask1 = 0xffffffff;
static float secs(Range s) { return (float)(s.t2 - s.t1) / CLOCKS_PER_SEC; }
@@ -53,7 +53,7 @@ Sample test_std_unordered_map() { s.test[FIND].sum = sum;
s.test[ITER].t1 = clock();
sum = 0;
- for (auto i: con) sum += i.second;
+ c_forrange (R) for (auto i: con) sum += i.second;
s.test[ITER].t2 = clock();
s.test[ITER].sum = sum;
s.test[DESTRUCT].t1 = clock();
@@ -98,7 +98,7 @@ Sample test_stc_unordered_map() { s.test[FIND].sum = sum;
s.test[ITER].t1 = clock();
sum = 0;
- c_foreach (i, cmap_x, con) sum += i.ref->second;
+ c_forrange (R) c_foreach (i, cmap_x, con) sum += i.ref->second;
s.test[ITER].t2 = clock();
s.test[ITER].sum = sum;
s.test[DESTRUCT].t1 = clock();
|
