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

cache get_torque_params #32560

Merged
merged 3 commits into from
May 31, 2024
Merged

Conversation

cl0cks4fe
Copy link
Contributor

@cl0cks4fe cl0cks4fe commented May 28, 2024

lots of io in get_torque_params (and it's is called twice in get_params for a lot of cars)

could also pass it through
re: #32536

I'll look for further ways to speed up

@github-actions github-actions bot added the car vehicle-specific label May 28, 2024
Copy link
Contributor

github-actions bot commented May 28, 2024

Thanks for contributing to openpilot! 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
    • the change is something we merge
    • include a route or your device' dongle ID if relevant

@sshane
Copy link
Contributor

sshane commented May 30, 2024

nice! speeds up the test with 8 procs from ~37 to ~30s for me! I wonder why the unit tests take 2x longer in CI though. I re-ran it

selfdrive/car/interfaces.py Outdated Show resolved Hide resolved
@sshane
Copy link
Contributor

sshane commented May 30, 2024

Can you see why the unit tests take much longer now?

@cl0cks4fe
Copy link
Contributor Author

@sshane selfdrive unittests?
Looks like it's ~1m faster than this run.

this PR: 1491 passed, 364 skipped, 4010 subtests passed in 420.02s (0:07:00)
that one: 1491 passed, 364 skipped, 4015 subtests passed in 477.50s (0:07:57)

@sshane

This comment was marked as outdated.

@cl0cks4fe
Copy link
Contributor Author

cl0cks4fe commented May 31, 2024

@sshane
different runners, which explains why your PRs are also fast. should this change?

@sshane sshane merged commit 8f4b00c into commaai:master May 31, 2024
16 checks passed
@deanlee
Copy link
Contributor

deanlee commented Jun 1, 2024

#32586 is a further optimization.

@sshane: commaai/opendbc#942 improves the initialization performance of CanParser & CanPacker, which should boost test_car_interface's runtime speed.

update:
The test_car_interface retrieves the car interface from the cache rather than reinitializing it each time:
CarInterface, CarController, CarState = interfaces[car_name]

Therefore, commaai/opendbc#942 does not enhance the performance of test_car_interface.

@cl0cks4fe cl0cks4fe deleted the speedup-test-car-interfaces branch June 1, 2024 20:47
Edison-CBS pushed a commit to Edison-CBS/openpilot that referenced this pull request Sep 15, 2024
* cache get_torque_params

* switch to cache

* Update selfdrive/car/interfaces.py

---------

Co-authored-by: Shane Smiskol <[email protected]>
old-commit-hash: 8f4b00c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
car vehicle-specific
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants