Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PERF: Avoid copy in pystac for ItemCollections #90

Merged
merged 3 commits into from
Sep 19, 2021

Conversation

TomAugspurger
Copy link
Collaborator

@TomAugspurger TomAugspurger commented Aug 30, 2021

Related Issue(s): #

#49
stac-utils/pystac#454

Description:

This uses the preserve_dict keyword added in stac-utils/pystac#454 to avoid a deepcopy on the items passed to pystac.ItemCollection. In these cases, we have the only reference to dictionary so it should be safe to mutate. As a small test:

import pystac_client

datetime = "2019-12-13/2019-12-13"
catalog = pystac_client.Client.open("https://planetarycomputer.microsoft.com/api/stac/v1")
%time search = catalog.search(collections=["sentinel-2-l2a"], datetime=datetime, limit=500)

That took ~20s on the latest released version and 14s after applying this change.

PR Checklist:

  • Code is formatted
  • Tests pass
  • Changes are added to the CHANGELOG

@codecov-commenter
Copy link

codecov-commenter commented Aug 30, 2021

Codecov Report

Merging #90 (2039c9c) into main (cae8956) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main      #90   +/-   ##
=======================================
  Coverage   77.46%   77.46%           
=======================================
  Files           9        9           
  Lines         537      537           
=======================================
  Hits          416      416           
  Misses        121      121           
Impacted Files Coverage Δ
pystac_client/item_search.py 77.82% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cae8956...2039c9c. Read the comment docs.

@TomAugspurger
Copy link
Collaborator Author

cc @gadomski

@matthewhanson matthewhanson merged commit d30c823 into stac-utils:main Sep 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants