Title: Performance fix for slcan · Issue #2027 · hardbyte/python-can · GitHub
Open Graph Title: Performance fix for slcan · Issue #2027 · hardbyte/python-can
X Title: Performance fix for slcan · Issue #2027 · hardbyte/python-can
Description: Describe the bug There is a performance issue with the way the reads are implemented in slcan.py. _read() reads serial data one byte at a time via read(1), even when multiple bytes (or complete frames) are already buffered in the OS seri...
Open Graph Description: Describe the bug There is a performance issue with the way the reads are implemented in slcan.py. _read() reads serial data one byte at a time via read(1), even when multiple bytes (or complete fra...
X Description: Describe the bug There is a performance issue with the way the reads are implemented in slcan.py. _read() reads serial data one byte at a time via read(1), even when multiple bytes (or complete fra...
Opengraph URL: https://github.com/hardbyte/python-can/issues/2027
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Performance fix for slcan","articleBody":"### Describe the bug\nThere is a performance issue with the way the reads are implemented in slcan.py. \n\n_read() reads serial data one byte at a time via read(1), even when multiple bytes (or complete frames) are already buffered in the OS serial receive buffer. Each read(1) incurs a syscall and, when no data is available, blocks for up to the serial timeout (default 1ms). A typical SLCAN frame is ~27 bytes, so each frame requires 27 separate read(1) calls minimum. This causes per-frame read latency of 50–850ms instead of \u003c1ms (particularly on windows which seem to have sub-optimal serial support).\n\nI'm using CAN-TP over CAN-FD, so I'm pushing this to the limits, which is why the performance issue has shown up.\n\n### Expected behavior\nThe serial is read as fast as possible\n\n### Additional context\n\nOS and version: Windows 11\nPython version: 3.10\npython-can version: 4.6.1\npython-can interface/s (if applicable): Canable2 running SL CAN firmware with FD support\n\n### The Fix\nI'll submit a pull request with a suggested fix that alters the serial read behaviour to be significantly faster.","author":{"url":"https://github.com/aaronfultonnz","@type":"Person","name":"aaronfultonnz"},"datePublished":"2026-02-13T23:11:33.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/2027/python-can/issues/2027"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:6df2c9a8-5eb0-2847-a855-5a33f4777536 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9826:1712DC:68BC4FB:89F3B65:6A5DD4A7 |
| html-safe-nonce | cc01acdc7cbdc745a6220cddb90b12b3ea3a323d2c718ebcbcdae710c3a57283 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5ODI2OjE3MTJEQzo2OEJDNEZCOjg5RjNCNjU6NkE1REQ0QTciLCJ2aXNpdG9yX2lkIjoiMjI5OTY5MjQwNzM3Njk1ODYzMSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 7e509f94fc45f85053f43fec4f9ca2973acd81151a767791849ed123474f2162 |
| hovercard-subject-tag | issue:3939691619 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/hardbyte/python-can/2027/issue_layout |
| twitter:image | https://opengraph.githubassets.com/c0065e6c67b9f3f69959a5aad470e293c369168bc1e2152ceafd2a161496d584/hardbyte/python-can/issues/2027 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/c0065e6c67b9f3f69959a5aad470e293c369168bc1e2152ceafd2a161496d584/hardbyte/python-can/issues/2027 |
| og:image:alt | Describe the bug There is a performance issue with the way the reads are implemented in slcan.py. _read() reads serial data one byte at a time via read(1), even when multiple bytes (or complete fra... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | aaronfultonnz |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5290d7e14309ad1e76106a9c4237bd1041517e83ea182c8ab756752cb0c6940b |
| turbo-cache-control | no-preview |
| go-import | github.com/hardbyte/python-can git https://github.com/hardbyte/python-can.git |
| octolytics-dimension-user_id | 855189 |
| octolytics-dimension-user_login | hardbyte |
| octolytics-dimension-repository_id | 69090889 |
| octolytics-dimension-repository_nwo | hardbyte/python-can |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 69090889 |
| octolytics-dimension-repository_network_root_nwo | hardbyte/python-can |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 9c975978430e9ad293956f2bbdaf153b1bd84a99 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width