[LAD] a *simple* ring buffer, comments pls?

James Morris jwm.art.net at gmail.com
Fri Jul 8 12:21:36 UTC 2011


On 8 July 2011 12:24, James Morris <jwm.art.net at gmail.com> wrote:

> So I'd thought I'd compare the execution time of 7000 items passing
> through the two 32-item ring buffers, with the execution time 7000
> items passing though 32-item jack-ringbuffers. details to come,
> probably to throw all this out the window.
>

    MSG_BUF_SIZE =  32,
    MSG_COUNT =     700000

JACK RING BUF:
[sirrom at scrapyard msg_test]$ time ./msg_test
          msg_test.c: 164                             main(): read
back loop count:700032

real	0m0.136s
user	0m0.260s
sys	0m0.003s
[sirrom at scrapyard msg_test]$ time ./msg_test
          msg_test.c: 164                             main(): read
back loop count:700032

real	0m0.136s
user	0m0.263s
sys	0m0.000s
[sirrom at scrapyard msg_test]$ time ./msg_test
          msg_test.c: 164                             main(): read
back loop count:700032

real	0m0.142s
user	0m0.273s
sys	0m0.003s



MY RING BUF WITH ATOMIC POINTERS

[sirrom at scrapyard msg_test]$ time ./msg_test
          msg_test.c: 286                             main(): read
back loop count:702657

real	0m0.169s
user	0m0.330s
sys	0m0.000s
[sirrom at scrapyard msg_test]$ time ./msg_test
          msg_test.c: 286                             main(): read
back loop count:738329

real	0m0.173s
user	0m0.337s
sys	0m0.000s
[sirrom at scrapyard msg_test]$ time ./msg_test
          msg_test.c: 286                             main(): read
back loop count:753976

real	0m0.171s
user	0m0.333s
sys	0m0.000s


A very simple data integrity check was used, (note: pointers to data
were stored in the rbufs rather than data), the main thread set the
items data to point to the item itself. the integrity check was that
it should come back intact, still pointing to itself. success in both
instances.

JACK's ringbuf, as most will have undoubtedly known all along, is
faster, and the test code required 50000 iterations less than when
using my ring buf. maybe somewhere, the atomics are required?
james.



More information about the Linux-audio-dev mailing list