This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://github.com/shipilev/benchmarks-scratch/blob/master/src/main/java/org/sample/StringToUTF8.java | |
It is always prudent to verify "sample" mode with "avgt", because timestamping overhead/accuracy | |
might skew the results in "sample". | |
Benchmark (length) Mode Samples Mean Mean error Units | |
o.s.StringToUTF8.getBytesViaWriter 1 avgt 5 1.301 0.198 us/op | |
o.s.StringToUTF8.getBytesViaWriter 10 avgt 5 1.287 0.048 us/op | |
o.s.StringToUTF8.getBytesViaWriter 100 avgt 5 1.605 0.240 us/op | |
o.s.StringToUTF8.getBytesViaWriter 1000 avgt 5 4.727 0.766 us/op |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Copyright 2014 The Netty Project | |
* | |
* The Netty Project licenses this file to you under the Apache License, | |
* version 2.0 (the "License"); you may not use this file except in compliance | |
* with the License. You may obtain a copy of the License at: | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
It looks like test is affected by where the guard variable is residing, this changeset isolates it: | |
http://hg.openjdk.java.net/code-tools/jcstress/rev/39a1c4786c47 | |
On x86_64, it can not fail without compiler being involved, since x86 is TSO: | |
$ jdk8/bin/java -XX:-RestrictContended -jar tests-custom/target/jcstress.jar -t ".*UnfencedAcquireReleaseTest.*" -v -iters 20 -f 5 | |
Observed state Occurrences Expectation Interpretation | |
[0, 0] ( 27,588,422) ACCEPTABLE Before observing releasing write to, any value is OK for ... | |
[0, 1] ( 167) ACCEPTABLE Before observing releasing write to, any value is OK for ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Run progress: 0.00% complete, ETA 00:00:05 | |
# VM invoker: /home/shade/Install/jdk8u0/jre/bin/java | |
# VM options: <none> | |
# Fork: 1 of 1 | |
# Warmup: <none> | |
# Measurement: 5 iterations, 1 s each | |
# Threads: 1 thread, will synchronize iterations | |
# Benchmark mode: Throughput, ops/time | |
# Benchmark: org.openjdk.jmh.samples.JMHSample_01_HelloWorld.wellHelloThere | |
Iteration 1: 1838576.986 ops/ms |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ jdk8b132/bin/java -server -XX:-RestrictContended -jar jcstress.jar -t ".*UnfencedAcquireReleaseTest.*" -v -f 0 -iters 1000 | |
(ETA: n/a) (R: 5.82E+12) (T: 1/0) (F: 0/0) (I: 0/1000) [OK] o.o.j.t.fences.UnfencedAcquireReleaseTest | |
Observed state Occurrences Expectation Interpretation | |
[0, 0] ( 190,046,972) ACCEPTABLE Before observing releasing write to, any value is OK for ... | |
[0, 1] ( 234) ACCEPTABLE Before observing releasing write to, any value is OK for ... | |
[0, 2] ( 322) ACCEPTABLE Before observing releasing write to, any value is OK for ... | |
[0, 3] ( 178,121) ACCEPTABLE Before observing releasing write to, any value is OK for ... | |
[1, 0] ( 572) ACCEPTABLE_INTERESTING Without fence or volatile can read the default or old val... | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.sample; | |
import org.openjdk.jmh.annotations.BenchmarkMode; | |
import org.openjdk.jmh.annotations.Fork; | |
import org.openjdk.jmh.annotations.GenerateMicroBenchmark; | |
import org.openjdk.jmh.annotations.Measurement; | |
import org.openjdk.jmh.annotations.Mode; | |
import org.openjdk.jmh.annotations.OutputTimeUnit; | |
import org.openjdk.jmh.annotations.Param; | |
import org.openjdk.jmh.annotations.Scope; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.sample; | |
import org.openjdk.jmh.annotations.BenchmarkMode; | |
import org.openjdk.jmh.annotations.Fork; | |
import org.openjdk.jmh.annotations.GenerateMicroBenchmark; | |
import org.openjdk.jmh.annotations.Measurement; | |
import org.openjdk.jmh.annotations.Mode; | |
import org.openjdk.jmh.annotations.OutputTimeUnit; | |
import org.openjdk.jmh.annotations.Param; | |
import org.openjdk.jmh.annotations.Scope; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Entering generation 0 | |
--------------------------------------- | |
Baseline score: 663.60 ops/ms | |
678.53 ops/ms ( +2.25%) -XX:FreqInlineSize=325 -XX:InlineSmallCode=1000 -XX:MaxInlineLevel=9 -XX:MaxInlineSize=35 -XX:MaxRecursiveInlineLevel=1 -XX:MinInliningThreshold=250 | |
676.79 ops/ms ( +1.99%) -XX:FreqInlineSize=325 -XX:InlineSmallCode=1000 -XX:MaxInlineLevel=9 -XX:MaxInlineSize=35 -XX:MaxRecursiveInlineLevel=1 -XX:MinInliningThreshold=250 | |
673.78 ops/ms ( +1.53%) -XX:FreqInlineSize=325 -XX:InlineSmallCode=1000 -XX:MaxInlineLevel=9 -XX:MaxInlineSize=35 -XX:MaxRecursiveInlineLevel=1 -XX:MinInliningThreshold=250 | |
673.55 ops/ms ( +1.50%) -XX:FreqInlineSize=325 -XX:InlineSmallCode=1000 -XX:MaxInlineLevel=9 -XX:MaxInlineSize=35 -XX:MaxRecursiveInlineLevel=1 -XX:MinInliningThreshold=250 | |
670.98 ops/ms ( +1.11%) -XX:FreqInlineSize=325 -XX:InlineSmallCode=1000 -XX:MaxInlineLevel=9 -XX:MaxInlineSize=35 -XX:MaxRecursiveInlineLevel=1 -XX:MinInliningThreshold=250 | |
670.82 ops/ms ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is a class: | |
class C { | |
final int v; | |
C(int v) { | |
this.v = v; | |
} | |
int sqr() { | |
return v*v; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*** Figuring out what "no vm operation" means here in -XX:+PrintSafepointStatistics: | |
vmop [threads: total initially_running wait_to_block] [time: spin block sync cleanup vmop] page_trap_count | |
0.320: Deoptimize [ 7 0 0 ] [ 0 0 0 0 0 ] 0 | |
1.320: no vm operation [ 8 1 1 ] [ 0 0 0 0 0 ] 1 | |
4.061: EnableBiasedLocking [ 8 1 1 ] [ 0 0 0 0 0 ] 1 | |
5.222: RevokeBias [ 8 0 1 ] [ 0 0 0 0 0 ] 0 | |
5.831: RevokeBias [ 8 0 0 ] [ 0 0 0 0 0 ] 0 | |
6.440: RevokeBias [ 8 0 0 ] [ 0 0 0 0 0 ] 0 | |
7.049: RevokeBias |