Hi Aleksej, On 10/13/2013 02:00 PM, Aleksej Efimov wrote: > The benchmark code: > @GenerateMicroBenchmark > @BenchmarkMode(Mode.AverageTime) > @OutputTimeUnit(TimeUnit.MICROSECONDS) > public void testMethod(BlackHole bh) { > bh.consume( new XPathContext() ); > }
Not bad. The syntactic nit: you can "just" return the value and JMH will feed it to the blackhole implicitly: @GenerateMicroBenchmark @BenchmarkMode(Mode.AverageTime) @OutputTimeUnit(TimeUnit.MICROSECONDS) public XPathContext testMethod() { return new XPathContext(); } > Benchmark results: > Without proposed fix: 9,496 us/op > With proposed fix: 8,570 us/op Whoa, 8.5 us to create the XPathContext seems a lot. If the change in performance for 8.5 -> 9.5 us/op was reported as performance regression, I wonder if we should optimize XPathContext further. (Not in the scope of this change of course). -Aleksey.