Skip to content

Instantly share code, notes, and snippets.

@ben-manes
Last active December 19, 2015 19:28
Show Gist options
  • Save ben-manes/6005989 to your computer and use it in GitHub Desktop.
Save ben-manes/6005989 to your computer and use it in GitHub Desktop.
public final class FinalizeBenchmark extends Benchmark {
public int timeFinalize(int reps) {
int dummy = 0;
for (int i = 0; i < reps; i++) {
Object o = new Object() {
@Override protected void finalize() {
toString();
}
};
dummy = o.hashCode();
}
return dummy;
}
public static void main(String[] args) throws Exception {
CaliperMain.main(FinalizeBenchmark.class, args);
}
}
This selection yields 2 experiments.
Starting experiment 1 of 2: {instrument=allocation, method=Finalize, vm=default, parameters={}}
Complete!
Starting experiment 2 of 2: {instrument=micro, method=Finalize, vm=default, parameters={}}
ERROR: Trial failed to complete (its results will not be included in the run):
Trial exceeded the total allowable runtime (30s). The limit may be adjusted using the --time-limit flag.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment