Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce posix.Serial.read1 calls #6

Open
tiagocoutinho opened this issue Dec 7, 2020 · 0 comments
Open

Reduce posix.Serial.read1 calls #6

tiagocoutinho opened this issue Dec 7, 2020 · 0 comments
Labels
enhancement New feature or request

Comments

@tiagocoutinho
Copy link
Owner

The posix implementation of _read() calls _read1() for each byte received.
The issue is that read1 is quite expensive because it has create an event object and register it as a reader in the event loop.
(See https://github.com/tiagocoutinho/serialio/blob/master/serialio/aio/posix.py#L36)

A better option would be to launch a task in the background reading from the fd and storing read requests in the buffer.
This task would be launched in the Serial constructor so there would be one task per serial connection.

FYI, this is what is done for RFC2217 and also indirectly in the raw tcp connection.

It is not a bug but a good enhancement

@tiagocoutinho tiagocoutinho added the enhancement New feature or request label Dec 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant