Merged
Conversation
a294345 to
4e64d07
Compare
22c4368 to
5bb1f06
Compare
080c92b to
7187ef7
Compare
…kStream` Allows the user to pass `copy=False` to improve performance when a copy is not needed. The default is `copy=True`, preserving the original behavior.
Also apply to Orbit and MockStream (PhaseSpacePosition subclasses). Note that multiplying by a unit creates a copy of the value, so we can return such Quantities without an additional copy.
7187ef7 to
35e5eb0
Compare
adrn
approved these changes
Oct 13, 2025
Owner
adrn
left a comment
There was a problem hiding this comment.
Very nice, and agree that this is worthwile!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Describe your changes
This is a relatively small change to optimize orbit integrations with
save_all=True. In general, turning on this option has resulting in puzzlingly slow integrations. Part of the bottleneck turns out to be making copies of the pos/vel arrays when wrapping them inQuantityobjects during the output stage. This PR adds acopykwarg toPhaseSpacePosition,Orbit, andMockStreamto allow arrays to be passed though without copies.The performance improvement is about 1.3x-2.5x, modest but worthwhile:
Note that the absolute performance is still lower than in #447 (
save_all=False), but we do expect there to be some overhead to saving relatively large orbit arrays.Although the focus of this PR is on the orbit integration performance, I did a general pass through the code to add
copy=Falsewhen it was clearly safe to do so.Checklist
CHANGES.rst)