Skip to main content

Please review benchmark instrumentation.

1 reply [Last post]
bkurotsu
Offline
Joined: 2004-12-13

Please review for style and other optimizations you can think of. More benchmark points will be inserted later.

https://jtharness.dev.java.net/source/browse/jtharness?view=rev&rev=1697

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
fda
Offline
Joined: 2005-05-27

First impression: too many extra code inserted.

Would it make sense to add a new utility class like Benchmark with a static method
print(String resource, long duration, WorkDir wd, Object[] args) {
if ( !benchmarksRequired ) { return; }
Logger logger = createLogger(wd);
logger.print(...);
}

If we go further, instead of coding

long start = currentTime();
doSomeAction();
long duration = currentTime() - start;
Benchmark.print(...);

we can write:
new Bechmark(...) {
void action() { doSomeAction(); }
}.run();

But it opt for the first approach.