You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* add profimp dev dep
* made imports lazy
* more repeats for import benchmarks
* add profimp to optional requirements
* relax pre-commit ignore; cleanup optional deps
* tests: force string annotations
---------
Co-authored-by: Philipp A. <flying-sheep@web.de>
Running all the benchmarks is usually not needed. You run the benchmark using `asv run`. See the [asv documentation](https://asv.readthedocs.io/en/stable/commands.html#asv-run) for interesting arguments, like selecting the benchmarks you're interested in by providing a regex pattern `-b` or `--bench` that links to a function or class method e.g. the option `-b timeraw_import_inspect` selects the function `timeraw_import_inspect` in `benchmarks/spatialdata_benchmark.py`. You can run the benchmark in your current environment with `--python=same`. Some example benchmarks:
17
+
Running all the benchmarks is usually not needed. You run the benchmark using `asv run`. See the [asv documentation](https://asv.readthedocs.io/en/stable/commands.html#asv-run) for interesting arguments, like selecting the benchmarks you're interested in by providing a regex pattern `-b` or `--bench` that links to a function or class method. You can run the benchmark in your current environment with `--python=same`. Some example benchmarks:
18
18
19
-
Importing the SpatialData library can take around 4 seconds:
19
+
### Import time benchmarks
20
+
21
+
Import benchmarks live in `benchmarks/benchmark_imports.py`. Each `timeraw_*` function returns a Python code snippet that asv runs in a fresh interpreter (cold import, empty module cache):
22
+
23
+
Run all import benchmarks in your current environment:
20
24
21
25
```
22
-
PYTHONWARNINGS="ignore" asv run --python=same --show-stderr -b timeraw_import_inspect
asv run --python=same --show-stderr -b timeraw_import_spatialdata
33
+
```
34
+
35
+
### Comparing the current branch against `main`
36
+
37
+
The simplest way is `asv continuous`, which builds both commits, runs the benchmarks, and prints the comparison in one shot:
38
+
39
+
```bash
40
+
asv continuous --show-stderr -v -b timeraw main faster-import
30
41
```
31
42
43
+
Replace `faster-import` with any branch name or commit hash. The `-v` flag prints per-sample timings; drop it for a shorter summary.
44
+
45
+
Alternatively, collect results separately and compare afterwards:
46
+
47
+
```bash
48
+
# 1. Collect results for the tip of main and the tip of your branch
49
+
asv run --show-stderr -b timeraw main
50
+
asv run --show-stderr -b timeraw HEAD
51
+
52
+
# 2. Print a side-by-side comparison
53
+
asv compare main HEAD
54
+
```
55
+
56
+
Both approaches build isolated environments from scratch. If you prefer to skip the rebuild and reuse your current environment (faster, less accurate):
57
+
58
+
```bash
59
+
asv run --python=same --show-stderr -b timeraw HEAD
60
+
61
+
git stash && git checkout main
62
+
asv run --python=same --show-stderr -b timeraw HEAD
63
+
git checkout - && git stash pop
64
+
65
+
asv compare main HEAD
66
+
```
67
+
68
+
### Querying benchmarks
69
+
32
70
Querying using a bounding box without a spatial index is highly impacted by large amounts of points (transcripts), more than table rows (cells).
33
71
34
72
```
35
-
$ PYTHONWARNINGS="ignore" asv run --python=same --show-stderr -b time_query_bounding_box
73
+
$ asv run --python=same --show-stderr -b time_query_bounding_box
0 commit comments