Skip to content

Instantly share code, notes, and snippets.

@ahh
Created February 24, 2017 03:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ahh/08e69204fc9154149b59307546bc3598 to your computer and use it in GitHub Desktop.
Save ahh/08e69204fc9154149b59307546bc3598 to your computer and use it in GitHub Desktop.
Bad view benchmark
void BM_View(int reps) {
rcu::View<char> shared;
SpawnNThreadsRunning(15, [&shared]() {
for (int i = 0; i < reps; ++i) {
auto snapshot = shared.Get();
// ... do some meaningless work...
}
});
for (int i = 0; i < reps; ++i) {
auto snapshot = shared.Get();
// ... do some meaningless work...
}
WaitForThreads();
}
BENCHMARK(BM_View)->Threads(1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment