-
Notifications
You must be signed in to change notification settings - Fork 7
/
README
38 lines (27 loc) · 1.2 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
All this code is under public domain.
This is my old experiment with shared-memory transport. It uses some
linux-specific facilities (futex & eventfd) and compares throughput of
shared memory 'pipe' (zero-copy) versus plain pipe (obviosly, copying).
You'll need libatomic-ops-dev and recent-enough Linux. But pipe
eventfd emulation should be compile-able on any Unix. And you may need
to tweak Makefile a bit.
Quite surpisingly, even minimal data processing pretty much negates
speed benefits of zero-copy shared memory transport (remove
JUST_MEMCPY define to see youself).
Another interesing thing is that old wakeup-via-pipe trick (used by
main_emulation) is not so much slower than efficent eventfd (0.44
seconds vs. 0.33 seconds).
My results: piping 300000000 (300 megs) of data takes:
./main_pipe (plain read & write to/from pipe)
~0.68 sec
./main_emulation (portable eventfd emulation via pipe)
~0.44 sec
./main_futex (futex variant)
~0.93 sec
./main_eventfd (eventfd variant 1)
~0.40
./main_efd_nonblock (eventfd variant 2)
~0.33
A bit more elaborate processing of data (generation & verification via
nrand48) gives times around 10 sec, where difference between pipe
implementation doesn't matter that much.