← index #8358PR #17330
Related · high · value 0.322
QUERY · ISSUE

pyboard.py very slow on windows, reason and solution

openby harbaumopened 2022-02-26updated 2024-09-08
toolsneeds-info

I have recently adopted my µPIDE Micropython IDE to use pyboard.py for remote communication. I soon noticed that transfers from the device to the host are 5 times slower under Windows 10 than under Linux. My previous own version did not have such an issue,

It turned out that serial.inWaiting() is awfully slow on Windows 10 and it's being called for every single byte that's being read via read_until().

As a solution I wrote a little buffering serial wrapper.
https://github.com/harbaum/upide/blob/main/src/buffered_serial.py

This can be used in pyboard.py like import buffered_serial as serial in https://github.com/micropython/micropython/blob/0a217624e1d26899986d3e79eb604652da540b00/tools/pyboard.py#L268

This avoids calling inWaiting() permanently and as a result pyboard.py's read performance now feels similar to Linux.

P.S.: This is not yet included in a µPIDE release, so the latest v1.1.0 still shows that slowness.

CANDIDATE · PULL REQUEST

tools/pyboard.py: Port recent patchs from mpremote serial transport, to add timeouts for non-responsive serial ports

mergedby dpgeorgeopened 2025-05-20updated 2025-06-02
tools

Summary

This applies #16513 and #16616 (made for mpremote) to tools/pyboard.py. They add timeouts to the initial connection phase to a target board, to help with non-responsive serial ports. Without these patches pyboard.py can hang indefinitely waiting for a board to respond.

Testing

To be tested by @hmaerki on Octoprobe.

Trade-offs and Alternatives

The test runners still use pyboard.py. Eventually it would be good to change them to use mpremote as the backend, but that's a lot more effort.

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied