-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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
Avoid including AP_InertialSensor.h in headers #28933
base: master
Are you sure you want to change the base?
Conversation
increases amount of work compiler needs to do for no good reason
increases amount of work compiler needs to do for no good reason
increases amount of work compiler needs to do for no good reason
increases amount of work compiler needs to do for no good reason
increases amount of work compiler needs to do for no good reason
increases amount of work compiler needs to do for no good reason
increases amount of work compiler needs to do for no good reason
increases amount of work compiler needs to do for no good reason
increases amount of work compiler needs to do for no good reason
increases amount of work compiler needs to do for no good reason
increases amount of work compiler needs to do for no good reason
increases amount of work compiler needs to do for no good reason
increases amount of work compiler needs to do for no good reason
increases amount of work compiler needs to do for no good reason
increases amount of work compiler needs to do for no good reason
increases amount of work compiler needs to do for no good reason
increases amount of work compiler needs to do for no good reason
Is this a measurable time save? Allowing inline isn't a bad reason. Of course the difference doesn't appear huge, and I am assuming these are not methods on the hot path. |
They are also methods of dubious implementation ("first usable" vs "primary").... We're also not particularly good at being consistent about whether the accel vector is a product of the AHRS or ins library. I have not attempted to measure time deltas. I think it's pretty clear that we won't form needless header dependencies during compilation, on top of any time savings from not including them - and that makes cache hits more likely. |
Okay, it seems those methods are very rarely used anyway, maybe it would be better to just kill them? I assume you are testing all the build options, that's the only other possibility of issue I can see. |
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.
We use inline for a reason
@@ -221,9 +220,7 @@ class AP_GyroFFT | |||
// whether analysis can be run again or not | |||
bool start_analysis(); | |||
// return samples available in the gyro window | |||
uint16_t get_available_samples(uint8_t axis) { |
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.
Please don't do this, this is in the hot path and inlining helps
|
||
// get the index of the current primary gyro sensor | ||
virtual uint8_t get_primary_gyro_index(void) const { |
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.
Simply un-inlining things requires a fair amount of testing, I suggest you don't do that in this PR
increases amount of work compiler needs to do for no good reason
... particularly when including in AP_AHRS.h, which is used a lot.