USB virtual serial benchmarks

Posted on Monday, June 3rd, 2013 in Arduino, USB by DP


Paul over at Dorkbotpdx has written a detailed article on his USB virtual serial receive speed benchmarks:

As part of optimization work to support large-scale LED projects, PJRC developed three simple USB virtual serial receive speed benchmarks. The complete source code is available below.

Here are the benchmark results for boards that currently support native USB virtual serial for Arduino sketches.  These tests show the importance of efficient USB software. The actual speed a board achieves depends much more on its software design than its raw hardware speed.

This entry was posted on Monday, June 3rd, 2013 at 1:30 pm and is filed under Arduino, USB. You can follow any responses to this entry through the RSS 2.0 feed. You can skip to the end and leave a response. Pinging is currently not allowed.

10 Responses to “USB virtual serial benchmarks”

  1. JTR says:

    1 byte transfers at > 8-times what is possible with full speed USB on the MAC. Sorry, I’m not buying this. Anyone who has spent anytime working with USB would instantly realize that there is something very wrong here…

    • Paul says:

      Of course, Mac doesn’t do any more magic besides buffering. Of course, that leads to higher latency, so any realtime ops (music, lighting, ahem to the author ) on Mac will have problems. It’s still kinda smart(ass), I wonder if Linux is easily tweakable to do it like Mac.

      • JTR says:

        Yes, clearly the MAC is pre buffering and and “packetizing” the single bytes. As you point out that can lead to some “unexpected” problems with latency. It is a real trade-off to be aware of. Thanks for doing this work because honestly I am surprised by this but sure glad I know that it is happening.

        I would suggest that a more valid benchmark would be to send and receive single bytes. Would be very interesting to see what sort of hit the MAC’s benchmark would take in that case….

      • Paul says:

        Just in case – I’m different Paul from the author of article ;-). But I agree that more cases needed to assess real-world performance. I also posted link to some other guy’s investigation into latency issues, but it awaits moderation so far.

      • Hi, Paul here (from PJRC, author of these benchmarks….)

        I’ve also done quite a bit of testing of latency, starting a couple years ago in collaboration with “Michu” of the Neophob blog and Pixel Invaders. He discovered and fixed a terrible latency problem in librxtx, and documented the results of native vs java latency with different boards. More recently the benchmarks have been run on other boards and discussed on the PJRC forum. I’m not going to post links here, but you can find all this info if you search. So far, no really nice and comprehensive article has been written to present these latency tests across many boards and all 3 operating systems. But plenty of testing has been done, and you can find the source code if you wish the run the tests yourself.

        One result is clear: OS-X actually has the lowest latency, despite their use of extra buffering to improve throughput. I know that seems counter-intuitive, but the results are very clear if you run relatively simple tests to actually measure the performance.

        Apple obviously has very smart developers who worked very effectively at optimizing performance.

  2. JTR says:

    Thanks for clarifying Paul No 2. Look forward to seeing the data on the latency issue.

  3. Drone says:

    Serial USB and even RS-232 has always been a problem with Arduino and it seems like it is still a problem with the due. If memory serves, buffering is the issue. Keep in-mind, the Teensy USB stack is closed source (unless something changed recently). Hmmm…

    • Teensy’s USB stack has always been open source. You can see the complete code in hardware/teensy/cores. You’re probably confusing the USB stack with the bootloader, which is proprietary. But the USB stack and everything else that your own code uses has complete source code published.

  4. michu says:

    Thanks for the post. I had this topic a long time on my TODO list for my PixelInvaders firmware. I rewrote the serial handling part and using ReadBytes, the speed increased by 20%. (OSX and a Teensy 2.0).

Leave a Reply

Notify me of followup comments via e-mail. You can also subscribe without commenting.

Recent Comments

  • Edward Mallon: A lot of us have ended up at this sensor / screen combination. But I couldn't afford the extravagance of six dedicated control lines on...
  • Andy: Me!!!
  • Bill F: Taking my place in line........
  • Mikee: 11
  • Clara: Thanks, Cinco!