Skip to content

Commit 7beaeb4

Browse files
committed
Update experimental/union hash function measurement comments
1 parent 26d85f1 commit 7beaeb4

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,4 @@ venv/*
3939
buildh2.bat
4040
gen_version.bat
4141
mkdocs_serve.sh
42+
experimental/a.out

experimental/extrinsic_storage.h

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
// *****************************************************************
1313
// Enable/disable debug instrumentation and statistics printing here
14-
constexpr auto debug_instrumentation = false;
14+
constexpr auto debug_instrumentation = true;
1515
// *****************************************************************
1616

1717

@@ -197,10 +197,12 @@ class extrinsic_storage {
197197
) noexcept
198198
-> Value*
199199
{
200-
auto hash = (((std::size_t)pobj)>>2) % Buckets;
201-
// in my experiments, this has smoother utilization (only
202-
// 6.6x difference between the most vs least popular bucket)
203-
// than std::hash<void*>{}(pobj) % Buckets (22x difference)
200+
//auto hash = std::hash<void*>{}(pobj) % Buckets; // A
201+
auto hash = (((std::size_t)pobj)>>2) % Buckets; // B
202+
// across the three major C++ implementations I tried, hash B has
203+
// smoother utilization (2% to 5% difference between the most vs
204+
// least popular bucket) than hash A (3.5% to 16% difference)
205+
204206
assert( 0 <= hash && hash < Buckets );
205207
if constexpr (debug_instrumentation) {
206208
// m_o_relaxed is enough, inc order doesn't matter for totals

0 commit comments

Comments
 (0)