WICG / serial

Serial ports API for the platform.
https://wicg.github.io/serial/
Other
255 stars 46 forks source link

High cpu usage on client desktop, when doing very fast read write operations for a few minutes. #169

Open gautam247gk opened 1 year ago

gautam247gk commented 1 year ago

Hi, I have been building an application that requires me to communicate with a micro controller. I initially send 2 bytes of data and the micro controller responds with 50 lines of data. Followed by me sending 2 bytes again and the cycle goes on for a few minutes. I observed that this is causing a high CPU usage on the client system. For very low end systems this has started to bottleneck my web application and my reads become delayed or very slowed after 30 seconds. On mid range to higher end systems, my reads get slow after 2 to 2.5 minutes. Any idea why this is happening or how to solve this?

reillyeon commented 1 year ago

This is very interesting behavior and I wonder if it is caused by memory pressure due to the allocation of ArrayBuffers for the received data. Can you provide example code which demonstrates this issue with a common microcontroller like an Arduino?