various coordinate performance improvements #258
Merged
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.
coordinate transformations in casa are spending most of their time allocating memory instead of actually computing. This set of patches improves this a situation a bit via a few small changes, see the commits for details.
The largest change is using a small Vector cache to avoid creating new Vectors for each MVPosition and Euler temporary object that are created en mass in the conversion code.
This cache could in theory be moved lower into the stack, e.g. in the allocator itself and the Array object would need to use placement new's to create its Block object, though this is quite tricky to get right so I opted for the simpler change of just caching the objects that are problematic.
A disadvantage is that the small cache is never free'd so it would show up in valgrind, but that can be handled with a suppression file.