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
public void meSoHotInline_avgt_jmhStub(InfraControl control, RawResults result, | |
SafepointProfiling_jmhType l_safepointprofiling0_0, Blackhole_jmhType l_blackhole1_1) throws Throwable { | |
long operations = 0; | |
long realTime = 0; | |
result.startTime = System.nanoTime(); | |
do { | |
l_safepointprofiling0_0.meSoHotInline(); /* LINE 163 */ | |
operations++; | |
// SP poll, uncounted loop | |
} while (!control.isDone); /* LINE 165 */ |
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
@Param("1000") | |
int size; | |
byte[] buffer; | |
boolean result; | |
@Setup | |
public final void setup() { | |
buffer = new byte[size]; | |
} |
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
// 1. counted = reps is int/short/byte | |
for (int i = 0; i < reps; i++) { | |
// You had plenty money, 1922 | |
} | |
// 2. Not counted | |
for (int i = 0; i < int_reps; i+=2) { | |
// You let other women make a fool of you | |
} |
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
public class WhenWillItExitInt3 { | |
public static void main(String[] argc) throws InterruptedException { | |
for (int i=0;i<100000;i++) { | |
countOdds(10); | |
} | |
Thread t = new Thread(() -> { | |
long l = countOdds(Integer.MAX_VALUE); | |
System.out.println("How Odd:" + l); | |
}); | |
t.setDaemon(true); |
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
private static long countOdds(int limit) { | |
long l = 0; | |
for (int i = 0; i < limit; i++) { | |
for (int j = 0; j < limit; j++) { | |
if ((j & 1) == 1) | |
l++; | |
} | |
} | |
return l; | |
} |
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
ECLIPSE | JAVAC | |
int i = 0; | int i = 0; | |
long l = 0; | long l = 0; | |
int j; | int j; | |
goto LOOP_I; | LOOP_OUTER: | |
OUTER: | if(i >= Integer.MAX_VALUE) | |
j=0; | goto EXIT_OUTER; | |
goto LOOP_J; | | |
| j=0; | |
INNER: | LOOP_INNER: |
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
ECLIPSE | JAVAC | |
0: lconst_0 | 0: lconst_0 | |
1: lstore_0 | 1: lstore_0 | |
2: iconst_0 | 2: iconst_0 | |
3: istore_2 | 3: istore_2 | |
| | |
4: goto 35 | 4: iload_2 | |
7: iconst_0 | 5: ldc #11 // int 2147483647 | |
8: istore_3 | 7: if_icmpge 41 // i >= INT_MAX goto 41 | |
9: goto 26 | 10: iconst_0 |
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 safepoint.hang; | |
public class WhenWillItExitInt { | |
public static void main(String[] argc) throws InterruptedException { | |
Thread t = new Thread(() -> { | |
long l = 0; | |
for (int i = 0; i < Integer.MAX_VALUE; i++) { | |
for (int j = 0; j < Integer.MAX_VALUE; j++) { | |
if ((j & 1) == 1) | |
l++; | |
} |
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
@Param({ "0" }) | |
int idleThreads; | |
Thread[] pool; | |
@Setup | |
public final void bakeACake() { | |
if (idleThreads != 0) { | |
pool = new Thread[idleThreads]; | |
for (int i = 0; i < idleThreads; i++) { | |
pool[i] = new Thread(() -> { |
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
@State(Scope.Thread) | |
@BenchmarkMode(Mode.AverageTime) | |
@OutputTimeUnit(TimeUnit.NANOSECONDS) | |
public class ArrayWrapperInterfaceBenchmark { | |
@Param({ "100", "1000", "10000" }) | |
public int size; | |
private DataSet datasetA; | |
private DataSet datasetB; | |
private static final class DataSet { |