-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
TST: Added Airspeed Velocity benchmarks for SphericalVoronoi #6686
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
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.
More that 10k points doesn't seem necessary, because the scaling of the timing with number of points is almost perfectly linear.
I would get rid of the inheritance completely. The code will be shorter without it, and you don't need constraints like using the same time_
method names.
self.points /= np.linalg.norm(self.points, axis=1)[:, np.newaxis] | ||
|
||
def teardown(self, num_points): | ||
del self.points |
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.
this teardown
method should not be necessary
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.
and the one below shouldn't be needed either. Did you see a problem without those?
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 it's due to the use of super
in the setup method of the subclass, why not make the generation of points on a sphere a small standalone function and call those. stuff like super
is best avoided unless really needed.
"""Perform spherical Voronoi calculation, but not the sorting of | ||
vertices in the Voronoi polygons. | ||
""" | ||
SphericalVoronoi(self.points, radius = 1, center = np.zeros(3)) |
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.
pep8 nitpick: no spaces around =
That could happen. It's always possible to fix the benchmark if that does happen. But if you want to include a longer-running test, you can use |
Ok, I think I've addressed all the comments so far. I didn't add a larger / slower test, but if the algorithm is substantially improved we can indeed expand to more points if that proves necessary. As it stands, this can still guard against regressions and facilitate demonstration of improvement via i.e., cythonization of the current algorithm. Note that 60k points causes a hard crash on a machine with 16 GB of RAM when performed in the context of the |
Purpose
This PR adds airspeed velocity benchmarks to the scipy benchmarks suite for
scipy.spatial.SphericalVoronoi
. The latter class has so far not been covered by performance benchmarks at all after Nikolai and I contributed it. The idea is to prevent performance regressions and also to lower the barrier to performance improvements by providing a convenient platform for benchmark comparison if / when I or others improve that code.Testing these new benchmarks
Here is how I tested the new benchmarks to check for issues:
At path
scipy/benchmarks
:This is a very limited test, but allowed me to squash the issues that cropped up. The graphical output looked ok and the text output was:
Considerations
asv compare
to conveniently measure progress between commit hashes over a broad range of values, but I suspect that the time cost would be too great over the span of the project.