Skip to content

Commit 43ad704

Browse files
authored
chore(dev/benchmarks): Fix Python benchmarks (#452)
We had renamed `bool()` to `bool_()`, which had caused the benchmarks to fail. I also documented how to run the Python benchmarks (since I'd forgotten since writing them!).
1 parent 1724785 commit 43ad704

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

dev/benchmarks/README.md

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,18 @@
2020
# Benchmarking nanoarrow
2121

2222
This subdirectory contains benchmarks and tools to run them. This is currently
23-
only implemented for the C library but may expand to include the R and Python
24-
bindings. The structure is as follows:
23+
only implemented for the C library and Python bindings but may expand to include
24+
the R bindings as well.
25+
26+
## C Library
27+
28+
The structure of the C benchmarks is as follows:
2529

2630
- Benchmarks are documented inline using [Doxygen](https://www.doxygen.nl/).
2731
- Configurations are CMake build presets, and CMake handles pulling a previous
2832
or local nanoarrow using `FetchContent`. Benchmarks are run using `ctest`.
2933
- There is a bare-bones report written as a [Quarto](https://quarto.org)
30-
document that renders to markdown.
34+
document that renders the C library results to markdown.
3135

3236
You can run benchmarks for a single configuration (e.g., `local`) with:
3337

@@ -50,3 +54,14 @@ python generate-fixtures.py # requires pyarrow
5054
cd apidoc && doxygen && cd ..
5155
quarto render benchmark-report.qmd
5256
```
57+
58+
## Python bindings
59+
60+
The Python benchmarks are a standard [asv](https://asv.readthedocs.io) project.
61+
You can run the benchmarks with:
62+
63+
```shell
64+
# pip install asv
65+
python generate-fixtures.py # requires pyarrow
66+
asv run
67+
```

dev/benchmarks/python/array.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def time_build_c_array_int32(self):
3636

3737
def time_build_c_array_bool(self):
3838
"""Create a bool array from 1,000,000 Python booleans"""
39-
na.c_array(self.py_bools, na.bool())
39+
na.c_array(self.py_bools, na.bool_())
4040

4141
def time_build_c_array_struct_wide(self):
4242
"""Create a struct array with 10,000 columns"""

0 commit comments

Comments
 (0)