perf(SeqManager): Use std::vector rather than std::set#1807
Conversation
It increases performance greatly[*] thanks to the cache locality of the vector. Scenarios where this is noticeable is when there are SeqManager drops due to, ie: Codec implementation or SimulcastConsumer dropping a packet. [*]: Using mediasoup-demo 1 audio|video producer and 100 audio|video consumers the CPU usage of SeqManager went of from >10% to <2%
Co-authored-by: Iñaki Baz Castillo <ibc@aliax.net>
|
Not sure whether this works properly in all situations.
https://en.cppreference.com/cpp/named_req/Compare Maybe realted to #1370 |
|
What about if we used the new Utils::UnwrappedSequenceNumber class that I borrowed from libwebrtc/dcsctp? |
That is totally unrelated to this PR. Here I'm just using a more efficient container for the job after measuring the performance. I believe there is an open issue with your suggestion which is another different topic than this one. |
Thanks, I'll check this info. |
This this no trouble. In our case if |
|
|
We've plenty of tests, all passing: https://github.com/versatica/mediasoup/blob/v3/worker/test/src/RTC/TestSeqManager.cpp#L1 Both use the same Any specific failing case/test on top of your mind? |
|
Ok, so IsLowerThan not strictly asymmetric: for some values, both I'll avoid the binary_search. |
|
@penguinol please check the latest commit. |
It increases performance greatly[*] thanks to the cache locality of the vector.
Scenarios where this is noticeable is when there are SeqManager drops due to, ie: Codec implementation or SimulcastConsumer dropping a packet.
[*]: Using mediasoup-demo with 1 audio|video producer and 100 audio|video consumers the CPU usage of SeqManager went down from >10% to <2%