Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change stream list to arrays and optimize stream lookup with SSE2 #508

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Commits on Mar 14, 2023

  1. Changed stream list to arrays and optimized stream lookup with SSE2.

    The stream list in the SRTP context is now implemented with two arrays:
    an array of SSRCs and an array of pointers to the streams corresponding
    to the SSRCs. The streams no longer form a linked list.
    
    Stream lookup by SSRC is now performed over the array of SSRCs, which
    is considerably faster because it is more cache-friendly. Additionally,
    the lookup is optimized for SSE2, which provides an additional massive
    speedup with many streams in the list. Although the lookup still has
    linear complexity, its absolute times are reduced and with tens to
    hundreds elements are lower or comparable with a typical rb-tree
    equivalent.
    
    Expected speedup of SSE2 version over the previous implementation:
    
    SSRCs    speedup (scalar)   speedup (SSE2)
    
    1        0.39x              0.22x
    3        0.57x              0.23x
    5        0.69x              0.62x
    10       0.77x              1.43x
    20       0.86x              2.38x
    30       0.87x              3.44x
    50       1.13x              6.21x
    100      1.25x              8.51x
    200      1.30x              9.83x
    
    These numbers were obtained on a Core i7 2600K.
    
    At small numbers of SSRCs the new algorithm is somewhat slower, but
    given that the absolute and relative times of the lookup are very small,
    that slowdown is not very significant.
    Lastique committed Mar 14, 2023
    Configuration menu
    Copy the full SHA
    b6186f4 View commit details
    Browse the repository at this point in the history