Skip to content

Commit cd861dc

Browse files
naschemehugovk
andauthored
Add the 'btree' benchmark. (#381)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
1 parent 1a49aa8 commit cd861dc

6 files changed

Lines changed: 469 additions & 0 deletions

File tree

doc/benchmarks.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,22 @@ Available benchmarks:
102102
See the `base64 module <https://docs.python.org/dev/library/base64.html>`_.
103103

104104

105+
btree
106+
-----
107+
108+
Benchmark a pure-Python implementation of a B-tree data structure. The tree
109+
is created with a relatively large number of nodes (default is 200,000). This
110+
attempts to simulate an application that operates on a large number of objects
111+
in memory (at least, large compared to other benchmarks currently in this
112+
suite). There are two variations of this benchmark: `btree` records the time to
113+
create the B-tree, run `gc.collect()` and then do some operations on it; the
114+
`btree_gc_only` variant records only the time to run `gc.collect()` and it
115+
skips the operations after creation.
116+
117+
Note that this benchmark does not create any reference cycles that the garbage
118+
collector will need to break to free memory.
119+
120+
105121
chameleon
106122
---------
107123

pyperformance/data-files/benchmarks/MANIFEST

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ asyncio_tcp_ssl <local:asyncio_tcp>
2626
asyncio_websockets <local>
2727
base64 <local>
2828
bpe_tokeniser <local>
29+
btree <local>
30+
btree_gc_only <local:btree>
2931
concurrent_imap <local>
3032
coroutines <local>
3133
coverage <local>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[tool.pyperformance]
2+
name = "btree_gc"
3+
extra_opts = ["all"]
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[tool.pyperformance]
2+
name = "btree_gc"
3+
extra_opts = ["--gc-only"]
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[project]
2+
name = "pyperformance_bm_btree"
3+
requires-python = ">=3.9"
4+
dependencies = ["pyperf"]
5+
urls = {repository = "https://github.com/python/pyperformance"}
6+
dynamic = ["version"]
7+
8+
[tool.pyperformance]
9+
name = "btree"

0 commit comments

Comments
 (0)