From 0f9faea702d833e39f4da6fbdbf1854cd185b4c8 Mon Sep 17 00:00:00 2001 From: Tom Augspurger Date: Mon, 30 Aug 2021 06:52:18 -0500 Subject: [PATCH 1/2] PERF: Avoid copy in pystac for ItemCollections --- pystac_client/item_search.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pystac_client/item_search.py b/pystac_client/item_search.py index 2afc8ccf..ea0527b7 100644 --- a/pystac_client/item_search.py +++ b/pystac_client/item_search.py @@ -400,7 +400,7 @@ def get_item_collections(self) -> Iterator[ItemCollection]: item_collection : pystac_client.ItemCollection """ for page in self._stac_io.get_pages(self.url, self.method, self.get_parameters()): - yield ItemCollection.from_dict(page, root=self.client) + yield ItemCollection.from_dict(page, preserve_dict=False, root=self.client) def get_items(self) -> Iterator[Item]: """Iterator that yields :class:`pystac.Item` instances for each item matching the given search parameters. Calls @@ -443,4 +443,4 @@ def get_all_items(self) -> ItemCollection: item_collection : ItemCollection """ feature_collection = self.get_all_items_as_dict() - return ItemCollection(feature_collection['features']) + return ItemCollection.from_dict(feature_collection, preserve_dict=False, root=self.client) From 2039c9c9029c77293d746fa2b8810d1e1d6477ff Mon Sep 17 00:00:00 2001 From: Tom Augspurger Date: Mon, 30 Aug 2021 06:57:01 -0500 Subject: [PATCH 2/2] changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 046f69a5..1c17c85c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +- Improved performance when constructing `pystac.ItemCollection` objects. + ## [v0.2.0] - 2021-08-04 ### Added