google / google/caliper

Support organizational classes

Open
#97 0 comments 0 reactions 0 assignees View on GitHub
component: runner P4 type=enhancement
Dominant language
Java
Stars
818
Forks
112
Avg merge
12m
Merged PRs (30d)
5

Description

```
It'd be great if we could directly run classes that exist to organize related
but non-comparable benchmarks.

In particular, it would be handy to support this:

public class RealToStringBenchmarks {

static class SpecialValues extends SimpleBenchmark {

@Param float value;
List valueValues = Arrays.asList(Float.NaN, Float.NEGATIVE_INFINITY, Float.POSITIVE_INFINITY);

public void timeFloat_toString(int reps) {
for (int rep = 0; rep < reps; ++rep) {
Float.toString(value);
}
}
}

static class RegularValues extends SimpleBenchmark {

@Param float value;
List valueValues = Arrays.asList(-0f, 0f, -123.45f,-123.45e8f, -123.45e36f);

public void timeFloat_toString(int reps) {
for (int rep = 0; rep < reps; ++rep) {
Float.toString(value);
}
}

public void timeStringBuilder(int reps) {
for (int rep = 0; rep < reps; ++rep) {
new StringBuilder().append(value);
}
}

public void timeFormatter(int reps) {
for (int rep = 0; rep < reps; ++rep) {
String.format("%f", value);
}
}

public void timeFormatter_dot2f(int reps) {
for (int rep = 0; rep < reps; ++rep) {
String.format("%.2f", value);
}
}
}
}
```

Original issue reported on code.google.com by `jessewil...@google.com` on 3 Nov 2010 at 12:08

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.