0

Is it any faster to read large blocks from a serial port than to read 1 byte at a time? It is general knowledge that reading blocks is usually faster. But, I am wondering if this is the case with serial communication because:

  1. Modern processor speeds with older protocols
  2. Serial transmits 1 bit at a time, unlike new communication methods like USB

As a follow up, how does using a USB as a serial connection (using something like the PL2303 driver, if that helps) affect this?

This came up when I was thinking about how to parse incoming messages from a serial port. With the current design, it would be easier to parse the data 1 character at a time, but, I also want to do the reads efficiently.

4
  • Userland application? Or kernel driver?
    – Fred Foo
    Feb 11, 2013 at 23:42
  • 1
    Then try reading blocks. One system call per byte can be quite a lot of overhead.
    – Fred Foo
    Feb 11, 2013 at 23:44
  • "Serial transmits 1 bit at a time, unlike new communication methods like USB" -- USB is also serial, and transfer one bit at a time. And by "serial", do you really mean EIA/RS-232 interfaces?
    – sawdust
    Feb 12, 2013 at 1:46
  • Is there an event that indicates new data is available? If so read all available bytes.
    – dbasnett
    Feb 13, 2013 at 18:03

1 Answer 1

1

Unless you're hitting the serial hardware directly I would imagine that your OS will buffer incoming data and it will still be more efficient to read blocks of data at a time.

You could do it both ways and see which is faster though.

Also surely USB is a just a fast serial connection given the S stands for serial.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.