Skip to content

Commit

Permalink
Add a benchmark to measure Rhino startup time
Browse files Browse the repository at this point in the history
I'm a bit worried about changes I'm making with lambdas and how that
will impact how long it will take Rhino to initialize all the standard
objects, so let's create a microbenchmark for that.
  • Loading branch information
gbrail committed Aug 24, 2024
1 parent 8c4b663 commit 2fdc1ef
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package org.mozilla.javascript.benchmarks;

import java.util.concurrent.TimeUnit;
import org.mozilla.javascript.Context;
import org.openjdk.jmh.annotations.*;

@OutputTimeUnit(TimeUnit.MICROSECONDS)
public class StartupBenchmark {
@Benchmark
public Object startUpRhino() {
try (Context cx = Context.enter()) {
return cx.initStandardObjects();
}
}
}

0 comments on commit 2fdc1ef

Please sign in to comment.