summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2021-02-05 23:34:35 +0100
committerTyge Løvset <[email protected]>2021-02-05 23:34:35 +0100
commitc4c903bb0cd9db33e1af0872b0b438f7da489c3c (patch)
tree3a4ebaba9f2c81039c0eaf23f66a37c5ff6d3e7f
parent1ea2043900095c3548d30ba4520fda6f854263c1 (diff)
downloadSTC-modified-c4c903bb0cd9db33e1af0872b0b438f7da489c3c.tar.gz
STC-modified-c4c903bb0cd9db33e1af0872b0b438f7da489c3c.zip
Yet another bug in csmap.h fixed. SHould be good now.
-rw-r--r--benchmarks/csmap_benchmark2.cpp14
-rw-r--r--stc/csmap.h7
2 files changed, 9 insertions, 12 deletions
diff --git a/benchmarks/csmap_benchmark2.cpp b/benchmarks/csmap_benchmark2.cpp
index 4ff1d903..5ef23862 100644
--- a/benchmarks/csmap_benchmark2.cpp
+++ b/benchmarks/csmap_benchmark2.cpp
@@ -62,11 +62,10 @@ static void insert_i(picobench::state& s)
size_t result = 0;
MapInt map;
stc64_srandom(seed);
- s.start_timer();
+ picobench::scope scope(s);
c_forrange (n, s.iterations())
map.emplace(stc64_random() & 0xfffffff, n);
s.set_result(map.size());
- s.stop_timer();
}
static void insert_csmap_i(picobench::state& s)
@@ -74,17 +73,16 @@ static void insert_csmap_i(picobench::state& s)
size_t result = 0;
csmap_i map = csmap_i_init();
stc64_srandom(seed);
- s.start_timer();
+ picobench::scope scope(s);
c_forrange (n, s.iterations())
csmap_i_emplace(&map, stc64_random() & 0xfffffff, n);
s.set_result(csmap_i_size(map));
- s.stop_timer();
csmap_i_del(&map);
}
#define P samples(S1).iterations({N1})
-//PICOBENCH(insert_i<omap_i>).P;
-//PICOBENCH(insert_csmap_i).P;
+PICOBENCH(insert_i<omap_i>).P;
+PICOBENCH(insert_csmap_i).P;
#undef P
@@ -238,8 +236,8 @@ static void ins_and_access_csmap_s(picobench::state& s)
}
#define P samples(S1).iterations({N1/5, N1/5, N1/5, N1/10, N1/40}).args({13, 7, 8, 100, 1000})
-//PICOBENCH(ins_and_access_s<omap_s>).P;
-//PICOBENCH(ins_and_access_csmap_s).P;
+PICOBENCH(ins_and_access_s<omap_s>).P;
+PICOBENCH(ins_and_access_csmap_s).P;
#undef P
PICOBENCH_SUITE("Map5");
diff --git a/stc/csmap.h b/stc/csmap.h
index ac51589c..4d897722 100644
--- a/stc/csmap.h
+++ b/stc/csmap.h
@@ -348,10 +348,9 @@ static struct csmap_rep _smap_inits = {0, 0, 0, 0};
return (C##_##X##_size_t) tn; \
} \
\
- STC_DEF void \
- C##_##X##_node_del_(C##_##X##_node_t *d, C##_##X##_size_t tn) { \
+ STC_INLINE void \
+ C##_##X##_node_unlink_(C##_##X##_node_t *d, C##_##X##_size_t tn) { \
struct csmap_rep *rep = c_container_of(d, struct csmap_rep, data); \
- keyDel(KEY_REF_##C(&d[tn].value)); \
d[tn].link[1] = (C##_##X##_size_t) rep->disp; \
rep->disp = tn; \
} \
@@ -463,7 +462,7 @@ static struct csmap_rep _smap_inits = {0, 0, 0, 0};
} else { /* unlink node */ \
tx = tn; \
tn = d[tn].link[ d[tn].link[0] == 0 ]; \
- C##_##X##_node_del_(d, tx); \
+ C##_##X##_node_unlink_(d, tx); \
} \
} \
tx = d[tn].link[1]; \