-
Notifications
You must be signed in to change notification settings - Fork 10
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
Fix bugs in analysis class #27
Comments
Sure, happy to have a look at it tomorrow. In the model/definition is the analysis method 'elevation' and the model in mm? I might have a go at making a unit test for performance at the same time to we can get a reliable benchmark for measuring performance in future cases. |
Thanks. Yeah, I thought it might be a units issue and switched to millimeters. Unfortunately it gave me the same results. |
@philipbelesky @mariuszhermansdorfer Unit tests are really not the best way to measure performance, use BenchmarkDotNet! |
@Sergio0694 Calling what I was looking for as a 'unit test' was poorly chosen — I think we need a way to be able to isolate and benchmark individual functions outside of running a 'live' setup so that provide a consistent set of inputs and thus more easily A/B test changes. Will give that a go with BenchmarkDotNet, thanks for the link! |
Hey, I've pushed up a5422c5 and e12b20a which should address this now. Could you confirm? I figured given the fault is in
|
Thanks @philipbelesky! Good call with committing directly. I’ll test it later today and let you know about the results. Having glanced over the code I suspect the use of |
Ok, so assuming a 10ms baseline, changing to an array lookup rather than a dictionary lookup seems to shave off about 3ms. Skipping calling into the If so maybe the role of I'm not sure how that works outside of situations where the elevation index of the pixel maps nicely to the table though. If the calling into the objects is indeed a bottleneck then it seems like we either need to accept it in cases like slope/aspect, or shift the logic for those calculations out of |
I had a look at the latest changes - now it works as expected. Having merged the branch with various speed improvements, which Sergio contributed to, it really is a bit disappointing to have such a slowdown just because of the way how we call the I like the progress you've made with this class so far, @philipbelesky. My tests seem to confirm your observations - after your recent fixes we have approx. 4ms worth of overhead. I agree with your suggestion to simplify the
The above would be calculated once and only re-calculated on user input. They would work as proper lookup tables i.e. calculated value for a given type of analysis is used as index in the corresponding array. |
The lookup tables are already separate in that each object inheriting from I think we can, hopefully, continue with having the construction of the lookup table itself handled by the different classes in As noted those lookup tables should be cached and only updated each time a relevant parameter changes rather than each time the definition calculates. I intended to get this going, but the time to construct the table should be pretty minimal and the prior lookup table was per-calculation anyway. I've setup #30 to track this. |
Note: I'm going to go ahead and close this as while the current performance is still a regression, the coloring function appears to work fine now and there are more specific issues to further investigate the performance issues. Feel free to reopen if its easier to continue the discussion here though! |
Hey @philipbelesky, it seems I have merged your most recent PR a bit prematurely. Got to test it with the Kinect just now and it doesn't seem to be working properly. Please see the linked video. Tried both in meters and millimeters with the same result.
Also, the new method is much slower than the previous one (20-25 vs. 1-3 ms). Disabling the call to
Analysis.AnalysisManager.GetPixelColor(depthPoint)
makes things snappy again.Could you please have a look at this?
The text was updated successfully, but these errors were encountered: