-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
perf: refactor to lazy interface loading #1932
base: master
Are you sure you want to change the base?
perf: refactor to lazy interface loading #1932
Conversation
There was a problem hiding this 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
a4b587c
to
e8bfae8
Compare
@@ -19,53 +18,54 @@ | |||
# jerk is measured over half a second | |||
JERK_MEAS_T = 0.5 | |||
|
|||
@pytest.fixture |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we do this without changing the structure of this test too much?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is to make the review easier, yes. I reduced the diff.
It seems nonsensical, because we are not parametrizing anymore over the test class, but directly over the test functions.
7616b65
to
70d0f30
Compare
70d0f30
to
72b8475
Compare
Relates to #1184
By moving the
car_helpers.py
imports to apytest.fixture
, we can shorten the collection time.Refactors the
car
tests to use:fixture
for the interface loading (this import is not executed during collection)coincidentally already fixed in Replace @parameterized.expand with @pytest.mark.parametrize to improve test speed #1930pytest.mark.parametrize
instead of theparametrize
in select places to enable properly using the fixture.I tried to keep the diff as small as possible.
There are 3 big chunks of time spent during the pytest collection on a fresh run (after compilation):
CANDefine
, aka the packer_pyx compiled library (only slow the first run after compilation)car_helpers.py
(always slow)"Fresh" denotes a recompilation of the
cython
modules.Collect only
pytest opendbc/car/tests --collect-only
compare to
pytest opendbc/can/tests --collect-only
Collection + execution
pytest opendbc/car/tests