Skip to content

car tests: cache CANDefine values and speed KF gain#3212

Open
javery556 wants to merge 1 commit intocommaai:masterfrom
javery556:codex/opendbc-32536-speedup
Open

car tests: cache CANDefine values and speed KF gain#3212
javery556 wants to merge 1 commit intocommaai:masterfrom
javery556:codex/opendbc-32536-speedup

Conversation

@javery556
Copy link

Refs commaai/openpilot#32536

Summary

  • cache CANDefine values per DBC so car state init does not rebuild the same enum maps for every Hypothesis example
  • precompute the constant speed-KF gain used by CarStateBase instead of solving it again on each initialization

Validation

  • Dongle ID: N/A (no car changes)
  • Route: N/A (no car changes)

Test plan

  • local xdist run of pytest selfdrive/car/tests/test_car_interfaces.py --durations=20 -q
    • before: 241 passed in 7.77s
    • after: 241 passed in 6.42s
  • local single-process run of pytest selfdrive/car/tests/test_car_interfaces.py -n0 --durations=20 -q
    • after: 241 passed in 46.94s
    • slowest test: 0.94s
    • average per test: about 0.195s
  • local spot check of historically slow cars with pytest selfdrive/car/tests/test_car_interfaces.py -n0 -k 'FORD_FOCUS_MK4 or MAZDA_CX9_2021 or SKODA_FABIA_MK4' --durations=10 -q
    • FORD_FOCUS_MK4: 0.19s
    • MAZDA_CX9_2021: 0.15s
    • SKODA_FABIA_MK4: 0.17s

@github-actions github-actions bot added can related to CAN tools, aka opendbc/can/ car related to opendbc/car/ labels Mar 15, 2026
@github-actions
Copy link
Contributor

Car behavior report

Replays driving segments through this PR and compares the behavior to master.
Please review any changes carefully to ensure they are expected.

✅ No changes detected

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for contributing to opendbc! In order for us to review your PR as quickly as possible, check the following:

  • Convert your PR to a draft unless it's ready to review
  • Read the contributing docs
  • Before marking as "ready for review", ensure:
    • the goal is clearly stated in the description
    • all the tests are passing
    • include a route or your device' dongle ID if relevant

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

can related to CAN tools, aka opendbc/can/ car related to opendbc/car/

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant