asv icon indicating copy to clipboard operation
asv copied to clipboard

Pretty names for benchmarks (class not function)

Open jeremiedbb opened this issue 4 years ago • 1 comments

Hi,

In the doc it's said that one can give custom benchmark_name and pretty_name for a benchmark (here). It's written that all attributes work for all benchmark types, but I can't make it work for a benchmark defined as a method of a class. This kind of makes sense since for a class the attribute is defined as a class attribute which would imply that all methods get the same pretty_name.

Is there a way to have pretty names for benchmarks defined as methods of a class ? or a wish/plan to support it ?

jeremiedbb avatar Apr 22 '20 14:04 jeremiedbb

I have been able to assign pretty_name to benchmark methods on a class by simply assigning a pretty_name attribute on the method object itself. I do this with a class decorator that dynamically populates methods on the class, but also assigns pretty_name and pretty_source: https://github.com/InvestmentSystems/static-frame-benchmark/blob/master/benchmarks/prototype.py

You can see the pretty names here: https://investmentsystems.github.io/static-frame-benchmark/

flexatone avatar Oct 21 '20 18:10 flexatone