Skip to content

Commit 76bf999

Browse files
goldvitalycopybara-github
authored andcommitted
Create a benchmark get_attr_one_obj_per_big_alloc.
The behavior is currently quadratic that shouldn't be a case. Benchmark Time CPU Iterations ------------------------------------------------------------------------------------ get_attr_one_obj_per_big_alloc/size:100 16264 ns 16261 ns 36290 get_attr_one_obj_per_big_alloc/size:512 264089 ns 264055 ns 2615 get_attr_one_obj_per_big_alloc/size:4096 17013654 ns 17012206 ns 43 get_attr_one_obj_per_big_alloc/size:10000 93770372 ns 93755818 ns 7 PiperOrigin-RevId: 718795326 Change-Id: I0f98c7c57c70014ea0b9320a39ab5656139f0ccf
1 parent 3a265ef commit 76bf999

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

py/koladata/benchmarks.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,22 @@ def get_attr_native(state):
266266
_ = ds.abc
267267

268268

269+
@google_benchmark.register
270+
@google_benchmark.option.arg_names(['size'])
271+
@google_benchmark.option.range(100, 10000)
272+
def get_attr_one_obj_per_big_alloc(state):
273+
size = state.range(0)
274+
alloc_size = 17
275+
objs = []
276+
schema = kd.uu_schema(a=kd.FLOAT32)
277+
for i in range(size):
278+
obj = schema(a=kd.slice([i] * alloc_size))
279+
objs.append(obj.S[0])
280+
ds = kd.slice(objs)
281+
while state:
282+
_ = ds.a
283+
284+
269285
@google_benchmark.register
270286
def uuid_item(state):
271287
a = kd.slice(42)

0 commit comments

Comments
 (0)