Speed up bottleneck in some differential unit lookup#7924
Speed up bottleneck in some differential unit lookup#7924eteq merged 2 commits intoastropy:masterfrom
Conversation
|
Hi there @adrn 👋 - 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 😃. Everything looks good from my point of view! 👍 If there are any issues with this message, please report them here. |
|
Add a benchmark to https://github.com/astropy/astropy-benchmarks/blob/master/benchmarks/coordinates.py ? |
|
See astropy/astropy-benchmarks#68 for benchmarks! |
|
LGTM, so merging so as not to block some other planned coordinates enhancements. As a side-note, we may want to re-work some of these preformance enhancements notes into a dedicated section, hence the "what's new needed" label. But not the end of the world if we don't get to that by release time. |
|
Belatedly: nice find! And does all look good. |
Representation objects store differential (velocity) data in a dictionary
.differentialswith keys set to the SI unit with which the differential is take. So, for velocities, this is's', because velocities are time derivatives of positional information.This PR makes a small change to the way
BaseDifferential._get_deriv_key()gets the differentials dictionary key from specified differential and representation objects. For scalar input, this makes_get_deriv_key()~20x faster, which makesrepresentation.with_differentials()~16x faster, which makes frame initialization ~7x faster (which also propagates to some paths through the SkyCoord initializer) when there is velocity data.Defining:
This PR:
Master: