-
Notifications
You must be signed in to change notification settings - Fork 463
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
Optimizations #1194
base: master
Are you sure you want to change the base?
Optimizations #1194
Conversation
This avoids duplicate GetTemperature()/GetPressure() calls.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1194 +/- ##
==========================================
+ Coverage 24.96% 25.01% +0.04%
==========================================
Files 170 170
Lines 19283 19307 +24
==========================================
+ Hits 4814 4829 +15
- Misses 14469 14478 +9 ☔ View full report in Codecov by Sentry. 🚨 Try these New Features:
|
8f6328e
to
16b1ba2
Compare
16b1ba2
to
e8f1255
Compare
It seems to me this PR should be split into 2 PRs because it is addressing 2 unrelated topics. Could you please do that ? Regarding the atmosphere optimization, it seems to me that the speed improvement of your PR is only for those who use However I'm a bit skeptical that your PR brings any measurable improvement to the speed of execution. In which case, the additional complexity would not be payed back. So could you please provide some data to substantiate your claim ? Thanks. |
Certainly!
In the case where a custom FGGroundCallback implementation is used but does not provide an overload for GetAGLevel(const FGLocation&) the extra indirection would indeed be incurred, however this only replaces the indirection already present in the code path without the change so there actually is no delta in cost or complexity of the code path. I intended to follow the pattern of the other non-pure overload just above the proposed change which has the same effect in terms of indirections and is the default method called on the interface (FGInertial). If I'm not mistaken there is an automatic benefit to clients using the default implementation. When customized and only the pure-virtual method is overridden the cost is the same as before. At the same time, clients that care about performance would now have a simple way to support the optimized path by adding the overload to their custom implementation. The only negative effect would be for a custom implementation that provides an override for the non-pure-virtual method above the proposed change (which is the one used internally by FGInertial for instance) but not the new proposed overload.
You will probably see a fairly small effect in the test cases/samples of this project. In applications that mix high-fidelity JSBSim simulated entities with a large number of simpler entities stepped outside JSBSim but operating in the same world and querying the JSBSim environment for certain properties the effect can become quite relevant. Totally understand though if this is not a change that makes sense to integrate from your perspective, it certainly is easy enough to maintain as a patch on the client side. Much larger gains are certainly possible when touching/limiting features, though I haven't been able to wrap those changes in a way that makes sense for the project repository yet. With this I've been trying to push back some changes that have come out of profile guided optimization and are more localized in case they make sense for the community. I will split up the PR to make it easier for you to integrate (or not). As always thanks for your work on this valuable project! |
I'm afraid not. Currently, for all classes inheriting from flowchart LR;
A[FGInertial::GetAltitudeAGL];
B["FGGroundCallback::GetAGLevel(FGLocation&, FGLocation&, FGColumnVector3&, FGColumnVector3&, FGColumnVector3&)"];
A-->B;
With your PR, for classes inheriting from flowchart LR;
A[FGInertial::GetAltitudeAGL];
B(["FGGroundCallback::GetAGLevel(FGLocation&)"]);
C["FGGroundCallback::GetAGLevel(FGLocation&, FGLocation&, FGColumnVector3&, FGColumnVector3&, FGColumnVector3&)"];
A-->B-->C;
So there is indeed an additional level of indirection and therefore a delta in cost and complexity.
Not sure what you mean, here.
That's only the case for classes that implement the new method
There are 2 strong assumptions behind these statements:
However, none of these assumptions can be taken for granted.
I'd certainly merge your change if you could prove that it brings some improvements. From what I'm seeing from your PR, the changes in performance - if any - will be negligible so there is not much point (performance-wise) in modifying the code. I'd be happy to be proven wrong but at the moment there are no facts to substantiate your claims so I'm staying on the conservative side. |
1/ Avoid copies and temporaries.
2/ Faster access to atmosphere values when multiple altitude dependent values are queried.