Repository navigation
Conversation
…ke frame_set. Use this to implement the FRAME_ATTR_NAMES_SET() 'macro' which speeds it up significantly (it could be removed entirely at this point, or at least deprecated, though it's used so frequently in the sky_coordinate module that it might still be useful to have a module-level alias to it)
… each attribute as a lambda. Might be nice to speed this up on the class-level as well which might be doable in some cases since frame attributes, for example, are per-class. Still trickier though.
…be calculated repeatedly in the loop. However, also removed a variable (n_attr_names) that was something of an unnecessary and premature 'optimization'
…ngle, and a few workarounds to performance shortcomunings in units.
There was a problem hiding this comment.
The performance gains from this change are marginal in most cases, but in a loop it does make a difference when the same attributes are looked up over and over again.
|
That's weird that those table tests failed. Not sure what that's about (none of the actual direct tests of the coordinates package failed). I'll have a look at it later. |
|
@embray - I don't quite understand why the speed-ups to |
|
@mhvk Currently (and this in of itself is probably not ideal--I was just adding what speedups I could without otherwise changing the current logic), every time |
There was a problem hiding this comment.
Of all the changes in this code this is one of the most relevant. But though instantiating the default wrap angle over and over again also hurt quite a bit in a loop.
There was a problem hiding this comment.
Fine to keep this of course! (Am slightly dismayed that it matters so much...)
There was a problem hiding this comment.
Not a huge amount but it was still an improvement.
There was a problem hiding this comment.
Interestingly, instantiating an Angle from an existing Angle is no faster than instantiating one from a Quantity (such as 360 * u.deg). In fact it may even be a smidge slower. That's not including the instantiation of the Quantity itself. We're talking Angle(a) vs. Angle(q). (not to say it's terribly slow in the first place)
There was a problem hiding this comment.
I'm looking at Angle initialisation right now. Hope to have a PR to your branch shortly...
|
At least some of the speedups in Angle still seem worthwhile regardless. |
|
@embray - agreed that some are good to do anyway. I mostly don't like the ones that have |
|
p.s. My guess would be that much of the gain of the |
|
I agree on that last comment--I thought of looking into it but |
|
We tried very hard to make sure |
|
I'm still having a hard time understanding the test failures here, particularly in the |
|
Yes, that fails also with the changes I made... Unfortunately, the table tests are so convoluted with things being set up in |
|
Well, it turns out all the table failures are related to my "enhancements" to The attribute lookup speedups are not insignificant, but they're not the most significant improvement in this PR either. So if it ends up overcomplicating things I'll just remove it. Though the way |
|
@embray - other than the attribute lookup stuff this should be good, right? So maybe you should just remove that part so we can get partial speedups in for 1.0, and then try to get the attribute speedups as a later PR for 1.0.x? Or might this be a bit too late for 1.0 anyway, given that it's doing quite a bit deep in the plumbing of SkyCoord...? |
|
Given that this is still failing on the CI I'd actually just vote to include it in 1.0.1 (I think we ruled in the past that performance fixes were ok in minor releases because they don't change the API). |
|
ok, sounds good - will assign it that milestone then. |
|
|
|
Yeah, I think it's best to delay this for now. I have thoughts on how to fix the attribute lookup thing so that it can still be benefitted from. Meanwhile, what the heck is landscape-bot? |
There was a problem hiding this comment.
@embray - I don't particularly like this change -- it adds complexity when at least for larger arrays the main culprit in making things slow is that the conversion has to involve making a copy (the scale determination is very fast, especially if units are the same). Also, my feeling is that this is the wrong place to optimize this -- the converter shouldn't even be called when the units are the same.
There was a problem hiding this comment.
I agree, I just haven't had a chance to work on this more.
|
Dropping this from the milestone until I have a chance to address the issues here. |
|
Definitely a good idea, though I sadly don't see myself having time to work on this soon. |
|
Conflicts and seems to have been replaced by #5598 |
|
@pllim - is that PR have everything from here? |
|
Actually no, but this has a better chance of being completed if @mhvk "absorbs" it rather than sitting around here. |
|
If this is closed, I'll simply never see it anymore, so I'll leave it open for now. I'll also set the milestone to 3.0; if this is seen then and nothing happened, just close. |
|
Hi humans 👋 - this pull request hasn't had any new commits for approximately 2 years. I plan to close this in a month if the pull request doesn't have any new commits by then. In lieu of a stalled pull request, please close this and open an issue instead to revisit in the future. Maintainers may also choose to add If you believe I commented on this issue incorrectly, please report this here. |
|
At this stage it is probably best to raise issues for the various fixes that were proposed here, and that were not yet implemented. |
|
⏰ Time's up! ⏰ I'm going to close this pull request as per my previous message. If you think what is being added/fixed here is still important, please remember to open an issue to keep track of it. Thanks! If this is the first time I am commenting on this issue, or if you believe I closed this issue incorrectly, please report this here. |
Here's a small collection of speedups aimed at the test case from #3323. These are very specifically aimed at that one case, but may help in other cases as well:
with the speedups in this branch I now get:
so improvement by an order of magnitude. There are plenty other things that could be done, but I shouldn't spend any more time on it right now (I may come back to it later). There are also a few open questions I left in the code as
# TODOcomments that might be worth a look.One of them in particular is that this obviates the need for the
FRAME_ATTR_NAMES_SETfunction, which I think could either be removed outright (since it isn't documented), or at least deprecated.