Add benchmark for xtra vs tokio mpsc channels#181
Add benchmark for xtra vs tokio mpsc channels#181thomaseizinger wants to merge 2 commits intomasterfrom
Conversation
|
I am guessing the major speed difference comes from the allocations. |
|
True - this is simply the cost you pay for dynamic message dispatch. I would wonder how it'd look if the Tokio example also dynamically dispatched message handlers |
Would that be a fair comparison though? The actor as shown in the benchmark is how I'd implement it. With an enum to handle multiple cases. |
It's comparing different things - in the dynamic dispatch case what we are really measuring is the channel performance of xtra's internal channel. Previously this could be extrapolated from benches of flume, but this is no longer the case |
As a user though, I don't really care what At least in these benchmarks, the mpsc channel is ~70x faster but I think we are operating at a latency scale here where if that difference matters to you, you are probably going to write everything yourself anyway? I've never worked on applications that were performance critical on that scale so I don't actually know. |
From a user perspective, it is not a useful measurement, I agree. However, it would still be useful to look at for us (the implementors) to see how fast xtra's channel is in comparison to tokio.
Agreed. 9us for sending one message is negligible for most applications. |
A first implementation of a benchmark. Here are some first results:
Fixes #116.