Skip to content

Commit

Permalink
Merge pull request #358 from hpyproject/antocuni/more-microbenchs
Browse files Browse the repository at this point in the history
Add a microbenchmark
  • Loading branch information
antocuni authored Sep 23, 2022
2 parents 7056f70 + 93b2dc6 commit 1804201
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions microbench/test_microbench.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,17 @@ class TestType:
The type is named `simple.Foo` in both cases.
"""

def test_allocate_obj(self, simple, timer, N):
import gc
Foo = simple.Foo
objs = [None] * N
gc.collect()
with timer:
for i in range(N):
objs[i] = Foo()
del objs
gc.collect()

def test_method_lookup(self, simple, timer, N):
obj = simple.Foo()
with timer:
Expand Down

0 comments on commit 1804201

Please sign in to comment.