automotive: index EcuSession supported responses instead of scanning - #5099
Merged
polybassa merged 1 commit intoAug 25, 2026
Merged
Conversation
Ecu.__update_supported_responses scans the whole supported-response list for every matched request/response pair, so a capture with many distinct responses costs time quadratic in the number of distinct responses. At 80, 160, 320, 640 and 1,280 distinct exchanges, processing took 36.73, 101.30, 337.14, 1,070.69 and 3,918.18 ms; the fitted exponent was 1.87. Keep a dictionary keyed by response class and serialized bytes alongside the existing list, and search only the matching bucket. The exact packet equality check still decides a match, so equality semantics are unchanged and the list callers already read is untouched. The measured exponent drops from 1.87 to 1.08. A repeated-response benchmark showed no distinguishable cost. AI-Assisted: yes (GPT-5.6-Cyber)
polybassa
approved these changes
Aug 25, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #5099 +/- ##
==========================================
+ Coverage 79.42% 80.59% +1.16%
==========================================
Files 372 390 +18
Lines 96507 96866 +359
==========================================
+ Hits 76652 78067 +1415
+ Misses 19855 18799 -1056
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ecu.__update_supported_responsesscans the entire supported-response list for every matchedrequest/response pair, so a capture carrying many distinct responses costs time quadratic in the
number of distinct responses.
EcuSessionenables this collection by default.At 80, 160, 320, 640 and 1,280 distinct exchanges, processing took 36.73, 101.30, 337.14, 1,070.69
and 3,918.18 ms — a fitted exponent of 1.87.
This keeps a dictionary keyed by response class and serialized bytes alongside the existing list
and searches only the matching bucket. The exact packet equality check still decides a match, so
equality semantics do not change, and the list callers already read is left exactly as it was.
The measured exponent drops from 1.87 to 1.08. A repeated-response benchmark showed no
distinguishable cost.
Test added in
test/contrib/automotive/ecu.uts.