Slcan speed optimization - #15
Conversation
…ing parser could not keep up with data flow on a hevily loaded bus.
|
Fun! What is the rationale behind using |
|
GIL indeed is an issue, but having a secondary thread simplifies the Do you think using multiprocessing here is a sensible idea? Fun! What is the rationale behind using threading.Thread rather than — |
|
I always use separate processes if I'm breaking a task out to improve throughput. In this case the objective is reduced latency rather than increased throughput, but I suspect a separate process will be better for that too. Using a separate process would probably require socket management be moved to that process, but it also avoids thread-safety problems since it forces looser coupling of tasks (e.g. via queues). I generally find that model easier to reason about than a shared-state+threading approach, although it can be more of a hassle to set up. |
|
There are two more data points worth considering.
I'm not sure further throughput/latency improvements worth the hassle. |
|
@bendyer I propose to accept this implementation since at any rate it offers better throughput than what we currently have in master. It is unclear to me whether it is necessary to tinker with multiprocessing at this point. |
…ference Review finding #15 (Low). The reference selects the right neighbor with cavl2_predecessor, an inclusive floor (offset <= right), so a fragment beginning exactly at the new fragment's end participates in overlap eviction; Python used a strict '<'. The divergence is observable only when overlapping fragments carry conflicting data (corruption or adversarial injection): the reference evicts the conflicting fragment and delivers the transfer, while Python kept it and dropped the transfer on CRC failure. Reference: udpard.c rx_fragment_tree_update. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CabiCDQ5DNBYq8WDKRzG4Z
This parser is much faster. It prevents data loss even on a fully congested bus at 1Mbps.