Replace boost::spsc_queue by a fast SPMC queue#135
Conversation
- pop_sample is now lockfree again, except if buffer full or empty and timeout is used - queue is much less of a bottleneck now
|
Using this branch... On localhost outlet and inlet on my Windows machine (i5-8400), the maximum number of channels I can support is about 2500 before the inlet can't keep up. At that channel count, SendDataInChunks uses 3-4% CPU 800 MB memory. ReceiveDataInChunks uses 45-50% CPU and 900 MB memory! My Macbook Pro is quite old (late 2013, i7-4850 2.3 GHz). iperf3 tells me that my WinPC --> Mac connection speed is 945 Mbit/s. I'll fire up a similar test on |
|
On Win-localhost, I won't bother testing the other configs. So the |
|
(Mostly for my own reference) |
|
Thanks for testing - I also have a pretty neat test script in my repo, let me dig that up tomorrow. This PR lays a nice foundation beyond which one can apply some additional, more aggressive optimisations when the time is right. I have one that replaces the remaining lock with a custom-tailored sync primitive that I used to reach 10 MHz on a ThinkPad T495 -- however I'd be hesitant to drop something like that in production without a convincing correctness proof or painful amounts of testing. |
C++20 has |
|
Ok as far as I'm concerned I'm good to go with that - @tstenner any vetoes about merging this in? Btw, picking up the discussion from the other PR, thx for the add_wrap optimizations & checking that force-inlining isn't necessary. Really wish I had more time to do those cleanups! |
Please refer to #91 by @chkothe and the discussion there.
This is simply the rebased version from @tstenner and with the latest master merged in.
I happen to have a need to test this so I thought I'd setup the PR too.
@chkothe , I would prefer to not have this PR and instead use only the original PR in #91. However, I think anything you do to rewrite the history would invalidate the in-line conversations and it would be a shame to lose those. I suppose you could stack on a bunch of
revertcommits, and then add back on the commits from Tristan's fork, but that would create a messy history in liblsl. I don't know of a perfect solution here. I leave it up to you.