Skip to content

Improve the performance of tiled decompression - #14430

Merged
saimn merged 13 commits into
astropy:mainfrom
Cadair:performance_issues_decompress_tile
Mar 8, 2023
Merged

saimn merged 13 commits into
astropy:mainfrom
Cadair:performance_issues_decompress_tile

Conversation

@Cadair

@Cadair Cadair commented Feb 22, 2023 •

Copy link
Copy Markdown
Member

This is a work in progress for the moment as we continue to iterate on the performance hot spots.

@github-actions

Copy link
Copy Markdown
Contributor

Thank you for your contribution to Astropy! 🌌 This checklist is meant to remind the package maintainers who will review this pull request of some common things to look for.

  • Do the proposed changes actually accomplish desired goals?
  • Do the proposed changes follow the Astropy coding guidelines?
  • Are tests added/updated as required? If so, do they follow the Astropy testing guidelines?
  • Are docs added/updated as required? If so, do they follow the Astropy documentation guidelines?
  • Is rebase and/or squash necessary? If so, please provide the author with appropriate instructions. Also see "When to rebase and squash commits".
  • Did the CI pass? If no, are the failures related? If you need to run daily and weekly cron jobs as part of the PR, please apply the "Extra CI" label. Codestyle issues can be fixed by the bot.
  • Is a change log needed? If yes, did the change log check pass? If no, add the "no-changelog-entry-needed" label. If this is a manual backport, use the "skip-changelog-checks" label unless special changelog handling is necessary.
  • Is this a big PR that makes a "What's new?" entry worthwhile and if so, is (1) a "what's new" entry included in this PR and (2) the "whatsnew-needed" label applied?
  • Is a milestone set? Milestone must be set but we cannot check for it on Actions; do not let the green checkmark fool you.
  • At the time of adding the milestone, if the milestone set requires a backport to release branch(es), apply the appropriate "backport-X.Y.x" label(s) before merge.

@github-actions

Copy link
Copy Markdown
Contributor

👋 Thank you for your draft pull request! Do you know that you can use [ci skip] or [skip ci] in your commit messages to skip running continuous integration tests until you are ready?

@astrofrog

Copy link
Copy Markdown
Member

We should try and re-write _iter_array_tiles to not use Numpy as I think this slows things down a bit

Comment thread astropy/io/fits/_tiled_compression/tiled_compression.py Outdated
Comment thread astropy/io/fits/_tiled_compression/codecs.py Outdated
Comment thread astropy/io/fits/_tiled_compression/tiled_compression.py Outdated

# If more than half the data is requested, read in all the heap.
# TODO: decide what heuristic we actually want here
if np.product(buffer_shape) > 0.5 * np.product(data_shape):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Cadair - we need to think about this!

@astrofrog astrofrog added Affects-dev PRs and issues that do not impact an existing Astropy release no-changelog-entry-needed labels Mar 6, 2023
@astrofrog
astrofrog force-pushed the performance_issues_decompress_tile branch from b2921ce to fff7370 Compare March 6, 2023 11:37
@astrofrog
astrofrog force-pushed the performance_issues_decompress_tile branch from 0825234 to 55c3580 Compare March 7, 2023 09:43
Comment on lines +143 to +145
if algorithm in ("RICE_1", "RICE_ONE", "PLIO_1") and tile_size < len(
tile_buffer
):

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤢

…ng .data might be more appropriate than using .section
@astrofrog
astrofrog marked this pull request as ready for review March 7, 2023 14:15
@astrofrog
astrofrog requested a review from saimn as a code owner March 7, 2023 14:15
@astrofrog

Copy link
Copy Markdown
Member

@saimn - I believe this is ready for review - this speeds things up by a factor of a few in our new tiled compression algorithm, to bring it a lot closer to the original performance in previous astropy versions.

Comment thread astropy/io/fits/_tiled_compression/codecs.py
# We have to calculate the tilesize from the shape of the tile not the
# header, so that it's correct for edge tiles etc.
settings["tilesize"] = prod(actual_tile_shape)
elif compression_type in ("RICE_1", "RICE_ONE"):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merge PLIO_1 with this one ?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

@astrofrog

Copy link
Copy Markdown
Member

@saimn - I've addressed your comments 😄

@astrofrog
astrofrog requested a review from saimn March 7, 2023 22:35

@saimn saimn left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice improvements, thanks @Cadair & @astrofrog !

@saimn saimn added this to the v5.3 milestone Mar 8, 2023
@saimn
saimn merged commit a3f4ae6 into astropy:main Mar 8, 2023
@Cadair
Cadair deleted the performance_issues_decompress_tile branch March 9, 2023 11:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Affects-dev PRs and issues that do not impact an existing Astropy release Docs io.fits no-changelog-entry-needed testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants