Skip to content

Commit

Permalink
Improve performace of TiledDataset repr (#467)
Browse files Browse the repository at this point in the history
* Change how we detect tiled dataset for speed

* Add a couple of repr benchmarks

* Add a performance improvement section to the changelog

* Add changelog

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
Cadair and pre-commit-ci[bot] authored Jan 6, 2025
1 parent cd50651 commit 9c17054
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions changelog/467.performance.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Improve the performance of the ``TiledDataset`` ``repr`` and ``str``.
1 change: 1 addition & 0 deletions changelog/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Each file should be named like ``<PULL REQUEST>.<TYPE>.rst``, where ``<PULL REQU
* ``breaking``: A change which requires users to change code and is not backwards compatible. (Not to be used for removal of deprecated features.)
* ``feature``: New user facing features and any new behavior.
* ``bugfix``: Fixes a reported bug.
* ``performance``: A performance improvement which does not change behaviour.
* ``doc``: Documentation addition or improvement, like rewording an entire session or adding missing docs.
* ``removal``: Feature deprecation and/or feature removal.
* ``trivial``: A change which has no user facing effect or is tiny change.
Expand Down
6 changes: 3 additions & 3 deletions dkist/dataset/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@


def dataset_info_str(ds_in):
# Check for an attribute that only appears on TiledDataset
# Not using isinstance to avoid circular import
is_tiled = hasattr(ds_in, "combined_headers")
# Import here to remove circular import
from dkist.dataset import TiledDataset
is_tiled = isinstance(ds_in, TiledDataset)
dstype = type(ds_in).__name__
if is_tiled:
tile_shape = ds_in.shape
Expand Down
5 changes: 5 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -173,3 +173,8 @@ write_to = "dkist/_version.py"
directory = "trivial"
name = "Trivial/Internal Changes"
showcontent = true

[[tool.towncrier.type]]
directory = "performance"
name = "Performance Improvements"
showcontent = true

0 comments on commit 9c17054

Please sign in to comment.