java - Caliper: why not use an annotation to define a benchmark? -
just found out caliper, , going through documentation - looks great tool (thanks kevin , gang @ google opensourcing it).
question. why isn't there annotation-based mechanism define benchmarks common use cases? seems like:
public class foo { // foo's actual code, followed by... @benchmark static int timefoobar(int reps) { foo foo = new foo(); (int = 0; < reps; ++i) foo.bar(); } } would save few lines of code , enhance readability.
we decided use timefoo(int reps) rather @time foo(int reps) few reasons:
- we still have lot of junit 3.8 tests , consistency
testfoo()scheme. - no need
import com.google.caliper.time - we'll end reporting benchmark name
timefoo foo. easy, it'smethodname.substring(4). if used annotations we'd end more complicated machinery handle names@time timefoo(int reps),@time benchmarkfoo(int reps),@time foo(int reps).
that said, we're reconsidering caliper 1.0.
Comments
Post a Comment