Synchronous performance is slower than .NET SerialPort
See original GitHub issueHi, first of all, thanks for this lib, reliability is greater and CPU usage is lower, great work! However, i noticed that the performance when doing several small packets synchronously is slower than .NET default SerialPort
My setup is as follows:
- Program send 64 bytes to device and blocks the thread with a
AutoresetEvent.WaitOne
- Device writes those 64 bytes to the flash memory and sends an
ACK\n
back to the program - Program receive data on the serial using the
DataReceived
event, validates theACK\n
and unblocks the Thread byAutoresetEvent.Set()
- Repeat until done
Comparison - this is the same code, device and firmware on both cases, the only thing that’s changed is the serial port: SerialPortStream:
.NET SerialPort
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Synchronous performance is slower than .NET SerialPort
Blocking directly on the Read() is at least twice as fast, but still slower than SerialPort. My colleague's protocol is fundamentally different ...
Read more >SerialPort.ReadLine() slow compared to manual method?
I ran into this issue in 2008 talking to GPS modules. Essentially the blocking functions are flaky and the solution is to use...
Read more >Thread: Serial port reading is very slow
Hi Folks I have a simple synchronous function that write n bytes to the serial port and reads the same number of bytes...
Read more >What is better - using SerialPort with or without await/async ...
I'm having an implementation using SerialPort in C# using Visual Studio 2019. I'm using it in a Windows Application, using .NET Framework ...
Read more >If you *must* use .NET System.IO.Ports.SerialPort
The BytesToRead property (completely unreliable); The Read, ReadExisting, ReadLine methods (handle errors completely wrong, and are synchronous); The PinChanged ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I would expect you can just include the csproj into your solution file.
Assuming that you’re blocking on your own ManualResetEvent for an event to occur, you might want to block on the Read itself.
Your colleague may be getting higher rates as all read/write is just a buffer operation, and every i/o loop just looks at what is pending to read/write.
The delays you’re seeing are probably thread changes.