pydata / sparse

Sparse multi-dimensional arrays for the PyData ecosystem
https://sparse.pydata.org
BSD 3-Clause "New" or "Revised" License
602 stars 126 forks source link

test: Adapt benchmarks to use `codspeed` #741

Closed DeaMariaLeon closed 3 months ago

DeaMariaLeon commented 3 months ago

What type of PR is this? (check all applicable)

Related issues

Checklist


Please explain your changes below.

Adapted benchmarks from original file benchmark_coo.py that was used to benchmark with asv. Now benchmarking with codspeed.

codspeed-hq[bot] commented 3 months ago

CodSpeed Performance Report

Merging #741 will not alter performance

Comparing DeaMariaLeon:bench2 (5c34b67) with main (0612373)

Summary

โœ… 14 untouched benchmarks

๐Ÿ†• 14 new benchmarks

Benchmarks breakdown

Benchmark main DeaMariaLeon:bench2 Change
๐Ÿ†• test_elemwise_broadcast[side=100-add] N/A 14 ms N/A
๐Ÿ†• test_elemwise_broadcast[side=100-mul] N/A 3.1 ms N/A
๐Ÿ†• test_elemwise_broadcast[side=1000-add] N/A 14.9 s N/A
๐Ÿ†• test_elemwise_broadcast[side=1000-mul] N/A 73.5 ms N/A
๐Ÿ†• test_elemwise_broadcast[side=500-add] N/A 1.7 s N/A
๐Ÿ†• test_elemwise_broadcast[side=500-mul] N/A 12.5 ms N/A
๐Ÿ†• test_index_fancy[side=100] N/A 3.5 ms N/A
๐Ÿ†• test_index_scalar[side=100] N/A 481.2 ยตs N/A
๐Ÿ†• test_index_slice2[side=100] N/A 1.6 ms N/A
๐Ÿ†• test_index_slice3[side=100] N/A 1.4 ms N/A
๐Ÿ†• test_index_slice[side=100] N/A 1.1 ms N/A
๐Ÿ†• test_matmul[side=1000] N/A 39.9 ms N/A
๐Ÿ†• test_matmul[side=100] N/A 2.7 ms N/A
๐Ÿ†• test_matmul[side=500] N/A 8 ms N/A
DeaMariaLeon commented 3 months ago

@hameerabbasi Regarding:

SEED = 42 I'd import this from a central place, so it can be changed just once.

It's not working the way I did it on this commit. But locally I did something else: I put them inside a conftest.py. Which it seems to work, except that I noticed that SEED and DENSITY vary on other files. Like elemwise_example.py, matmul_example.py, etc.

hameerabbasi commented 3 months ago

For seed, let's unify it. For density, we can leave it constant in each file where it's constant; and change it where it should be changed.

DeaMariaLeon commented 3 months ago

For seed, let's unify it.

What does this mean? set just one value for all the tests, on all the files? Set the value on conftest.py?

hameerabbasi commented 3 months ago

Set the value on conftest.py?

Set one value for everything in some central place.

DeaMariaLeon commented 3 months ago

I'll do the out-of-band changes on another PR if that's fine with you then.