pyperformance icon indicating copy to clipboard operation
pyperformance copied to clipboard

Add simple memory allocation benchmark

Open tiran opened this issue 3 years ago • 6 comments

tiran avatar Feb 08 '22 14:02 tiran

I'm happy landing this. Let's give some days if @vstinner wants to take a look.

pablogsal avatar Feb 08 '22 15:02 pablogsal

Does it belong to pyperformance which is supposed to be a set of "macro benchmarks"?

IMO it's to have benchmarks outside pyperformance. @ericsnowcurrently wants to add the ability to plug your own benchmark suite in pyperformance using configuration files, but I didn't follow his PR recently.

vstinner avatar Feb 08 '22 15:02 vstinner

Does it belong to pyperformance which is supposed to be a set of "macro benchmarks"?

I would say yes: we have things that are quite small in what they do anyway. C'mon, we even have unpacking tests:

https://github.com/python/pyperformance/blob/034f58be960ee88010b7a8046265ca88f0c35aa4/pyperformance/data-files/benchmarks/bm_unpack_sequence/run_benchmark.py#L10-L20

pablogsal avatar Feb 08 '22 16:02 pablogsal

C'mon, we even have unpacking tests:

Maybe these tests don't belong to pyperformance :-(

I would say yes: we have things that are quite small in what they do anyway.

It's up to you.

vstinner avatar Feb 08 '22 16:02 vstinner

Does it belong to pyperformance which is supposed to be a set of "macro benchmarks"?

@ericsnowcurrently wants to add the ability to plug your own benchmark suite in pyperformance

My PR landed a while back and is part of the most recent release.

That said, we already have a bunch of micro benchmarks so I'm not opposed to adding more. (We can separate the bunch later.) However, it would be worth marking them as "micro" sooner rather than later so they are easy to skip. That would involve adding/updating tags = "micro" in the [tool.pyperformance] section of each benchmark's pyproject.toml. For this PR it would probably be okay to do so just for the new benchmark.

ericsnowcurrently avatar Feb 08 '22 16:02 ericsnowcurrently

@tiran THe benchmark fails for pypy because sys.getsizeof doesn't work. Check the CI output

pablogsal avatar Feb 09 '22 22:02 pablogsal