Skip to content

Commit f418b04

Browse files
committed
docs: add performance check for search
1 parent 13f76a3 commit f418b04

File tree

3 files changed

+91
-14
lines changed

3 files changed

+91
-14
lines changed

docs/example.ipynb

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,57 @@
144144
" format=\"parquet[snappy]\",\n",
145145
")"
146146
]
147+
},
148+
{
149+
"cell_type": "markdown",
150+
"metadata": {},
151+
"source": [
152+
"## Search performance\n",
153+
"\n",
154+
"Here's a performance comparison when searching with **stacrs** versus [pystac-client](https://pystac-client.readthedocs.io/)."
155+
]
156+
},
157+
{
158+
"cell_type": "code",
159+
"execution_count": null,
160+
"metadata": {},
161+
"outputs": [
162+
{
163+
"name": "stdout",
164+
"output_type": "stream",
165+
"text": [
166+
"pystac-client: 7.600378751754761s (467 items)\n"
167+
]
168+
},
169+
{
170+
"ename": "TypeError",
171+
"evalue": "object of type '_asyncio.Future' has no len()",
172+
"output_type": "error",
173+
"traceback": [
174+
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
175+
"\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)",
176+
"Cell \u001b[0;32mIn[2], line 15\u001b[0m\n\u001b[1;32m 13\u001b[0m items \u001b[38;5;241m=\u001b[39m stacrs\u001b[38;5;241m.\u001b[39msearch(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mhttps://stac.eoapi.dev\u001b[39m\u001b[38;5;124m\"\u001b[39m, collections\u001b[38;5;241m=\u001b[39m[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mWildFires-LosAngeles-Jan-2025\u001b[39m\u001b[38;5;124m\"\u001b[39m])\n\u001b[1;32m 14\u001b[0m end \u001b[38;5;241m=\u001b[39m time\u001b[38;5;241m.\u001b[39mtime()\n\u001b[0;32m---> 15\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mstacrs: \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mend\u001b[38;5;250m \u001b[39m\u001b[38;5;241m-\u001b[39m\u001b[38;5;250m \u001b[39mstart\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124ms (\u001b[39m\u001b[38;5;132;01m{\u001b[39;00m\u001b[38;5;28;43mlen\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43mitems\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m items)\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n",
177+
"\u001b[0;31mTypeError\u001b[0m: object of type '_asyncio.Future' has no len()"
178+
]
179+
}
180+
],
181+
"source": [
182+
"import time\n",
183+
"from pystac_client import Client\n",
184+
"import stacrs\n",
185+
"\n",
186+
"client = Client.open(\"https://stac.eoapi.dev\")\n",
187+
"start = time.time()\n",
188+
"item_search = client.search(collections=[\"WildFires-LosAngeles-Jan-2025\"])\n",
189+
"items = list(item_search.items_as_dicts())\n",
190+
"end = time.time()\n",
191+
"print(f\"pystac-client: {end - start}s ({len(items)} items)\")\n",
192+
"\n",
193+
"start = time.time()\n",
194+
"items = await stacrs.search(\"https://stac.eoapi.dev\", collections=[\"WildFires-LosAngeles-Jan-2025\"])\n",
195+
"end = time.time()\n",
196+
"print(f\"stacrs: {end - start}s ({len(items)} items)\")"
197+
]
147198
}
148199
],
149200
"metadata": {

pyproject.toml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,9 @@ ignore_missing_imports = true
3737
asyncio_mode = "auto"
3838
asyncio_default_fixture_loop_scope = "function"
3939

40-
[tool.uv]
41-
dev-dependencies = [
40+
[dependency-groups]
41+
dev = [
4242
"maturin>=1.7.4",
43-
"mike>=2.1.3",
44-
"mkdocs-jupyter>=0.25.1",
45-
"mkdocs-material[imaging]>=9.5.45",
46-
"mkdocstrings[python]>=0.27.0",
4743
"mypy>=1.11.2",
4844
"pyarrow>=18.0.0",
4945
"pystac[validation]>=1.11.0",
@@ -52,6 +48,16 @@ dev-dependencies = [
5248
"ruff>=0.6.9",
5349
"stac-geoparquet>=0.6.0",
5450
]
51+
docs = [
52+
"mike>=2.1.3",
53+
"mkdocs-jupyter>=0.25.1",
54+
"mkdocs-material[imaging]>=9.5.45",
55+
"mkdocstrings[python]>=0.27.0",
56+
"pystac-client>=0.8.5",
57+
]
58+
59+
[tool.uv]
60+
default-groups = ["dev", "docs"]
5561

5662
[build-system]
5763
requires = ["maturin>=1.7,<2.0"]

uv.lock

Lines changed: 28 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)