crude read/write benchmark code...

Skip to first unread message

Chris M. Thomasson

Feb 20, 2019, 4:34:01 AM2/20/19
to Scalable Synchronization Algorithms
Fwiw, I wrote a crude new benchmark that measures how many reads and writes can be performed in a given amount of time. My algorithm vs std::shared_mutex. So, we are _primarily_ looking for how many reads can be performed in this test at 60 seconds. The number of threads is variable and is determined by std::hardware_concurrency * THREADS, set at 8 in the test. This is the latest version 0.1. It will say the version number in the output:

(hit refresh if you don't see version 0.1)

I had to change something, basically add a volatile so the compiler would not optimize the read iteration over the shared list away into oblivion.

Sorry about that... Anyway my system is:
cpu_threads_n = 4
threads_n = 32
writers = 16
readers = 16
test duration = 60 seconds

This is going to be different for each system. Readers iterate a shared linked list with 1000000 nodes in this test. Writers pop and push items, and never use new or delete. Well, so far, the timings I am getting on my end using MSVC 2017 is:

Testing Version 0.1: Chris M. Thomasson's Experimental Read/Write Mutex

Raw Reads: 54195
Raw Writes: 3232
reads_per_tick = 902
writes_per_tick = 53
Ticks = 60.0432

Testing Version 0.1: std::shared_mutex

Raw Reads: 23452
Raw Writes: 1873
reads_per_tick = 390
writes_per_tick = 31
Ticks = 60.0513

Well, when you get some time, can you run it?
Reply all
Reply to author
0 new messages