This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Benchmark Time(ns) CPU(ns) Iterations | |
----------------------------------------------------- | |
raw time: 56.25ns | |
BM_RCULocked 56.6 903 100000000 | |
raw time: 20.5ns | |
BM_View 20.6 329 100000000 | |
Benchmark Time(ns) CPU(ns) Iterations | |
----------------------------------------------------- | |
raw time: 57.01ns |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ahh@madcat % ./raw; echo $? | |
0 | |
ahh@madcat % ./raw; echo $? | |
48 | |
ahh@madcat % ./raw; echo $? | |
16 | |
ahh@madcat % ./raw; echo $? | |
32 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.globl _start | |
.section .text | |
_start: | |
movq $0x3c, %rax | |
movq %rsp, %rdi | |
andq $63, %rdi | |
syscall |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int64_t before = rdtsc(); | |
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... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int64_t before = rdtsc(); | |
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... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static rcu::View<char> shared; | |
void BM_View(int reps) { | |
for (int i = 0; i < reps; ++i) { | |
auto snapshot = shared.Get(); | |
// ... do some meaningless work... | |
} | |
} | |
BENCHMARK(BM_View)->Threads(16); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for (int i = 0; i < n; ++i) { | |
f(x, y, z) += q; | |
} |