Repository navigation
Conversation
|
Hi there @taldcroft 👋 - thanks for the pull request! I'm just a friendly 🤖 that checks for issues related to the changelog and making sure that this pull request is milestoned and labeled correctly. This is mainly intended for the maintainers, so if you are not a maintainer you can ignore this, and a maintainer will let you know if any action is required on your part 😃. I see this is a work in progress pull request. I'll report back on the checks once the PR is ready for review. If there are any issues with this message, please report them here. |
|
There's a problem when changing representations, but I have an idea how to fix. |
| def representation(self): | ||
| return self.frame.representation | ||
|
|
||
| @representation.setter |
There was a problem hiding this comment.
Unrelated to this PR, but this was not actually being called!
| raise AttributeError("'{0}' is immutable".format(attr)) | ||
|
|
||
| if not attr.startswith('_') and hasattr(self._sky_coord_frame, attr): | ||
| if attr == 'representationa' and 'index0_template' not in self.cache: |
There was a problem hiding this comment.
Ooops, leftover, will remove.
|
@mhvk @astrofrog - passing tests locally now. |
|
Ping @mhvk @eteq @astrofrog. Anyone? |
|
This looks really interesting! So just to be clear, even with the deepcopy you are getting a 20x speedup? (if so - wow!). Also I guess the deepcopy does return a different SkyCoord for each item? |
Yes and yes. |
|
Though I see now the uniqueness of returned values is not tested. Will do that, but in development I extensively tested by doing BTW, without the uniqueness requirement one can have a |
|
Ok and just to be clear, if we speed up |
|
@astrofrog, @taldcroft - I'm trying to put together a hack that just skips |
Yes, this PR introduces no change in public API. Obviously it adds a private attribute and method, but these can be removed in the future with no notice. |
|
I now tried cleaning up getting items, making sure one doesn't pass through deadly slow |
|
@mhvk - can you clarify : if you combine this with #6940 / #6941, do you get an additional speedup, or do thus essentially replace this? (my quick once-over suggests it does, but should be checked to determine whether this is worth keeping at least temporarily). Assuming that is the case, I think we hold onto this one in case problems appear in #6940 that prevents merging in time for 3.0, as I think this is a good thing to have if it's not replaced by the other two. Personally, I consider all this work unfair right now though. What's the point of having a performance-focused release in 3.1 if we do it all now? 😉 |
|
Timings on my mac laptop show that this PR still increases getitem speed by a factor of more than 11 after merging #6940 (which itself improved speed by a little less than a factor of two). Unless #6941 gets merged then the coordinates team should still consider this one. Astropy 2.0 current master (with #6940 merged) With this PR (rebased on current master with #6940) @ |
|
Went ahead and merge #6941, so this one won't go in to 3.0. More generally, I think we are agreed that we don't want to implement too much caching until we've taken a first crack at cleaning up the |
This addresses issue #3323 by implementing
SkyCoord.__getitem__using a cached scalar template SkyCoord and then filling in the representation component data and attributes.On my mac this speeds up getitem and iteration by a factor of about 20.