~skeeto/public-inbox

1

MSI HASH TABLE BENCHMARK

Details
Message ID
<CAAiNwPpPPqgdEjbm9vgrChzdJPmHRGN-1GaUjKC3ZHkfKjg9uw@mail.gmail.com>
DKIM signature
pass
Download raw message
https://godbolt.org/z/9Tf4s8WE4

I tried combining C and C++ versions in one Godbolt. Also using the
UBENCH.  https://github.com/sheredom/ubench.h/blob/master/ubench.h

If ubench is not used program does not finish.
If ubench is used assert in C version fails (    assert(!equal(ht[i], v));   )

Dusan Jovanovic MSc Arch, TOGAF(R)
---------------------------------------------------------------------
Before printing please consider a lot of various things, although
 just the preservation of the environment might be enough.
Details
Message ID
<20221020134804.ofqc3bwcltthutgc@nullprogram.com>
In-Reply-To
<CAAiNwPpPPqgdEjbm9vgrChzdJPmHRGN-1GaUjKC3ZHkfKjg9uw@mail.gmail.com> (view parent)
DKIM signature
missing
Download raw message
I couldn't figure out how to get it to compile or run it on the compiler 
explorer. If I copy the source locally it works fine without UBENCH (exits 
with status 42), and I don't see any reason why it wouldn't. It looks like 
UBENCH runs the function multiple times — a good idea — but the benchmark 
is designed to only run once due to that static variable for the hash 
table. It's already filled out on the second call, so the assert fails. To 
fix, either memset() the table on entry or exit, or dynamically allocate 
it with a calloc() or zero-initialized new.

With that change, UBENCH runs to completion and I get numbers from UBENCH 
that line up pretty closely with my README.
Reply to thread Export thread (mbox)