Skip to content

Instantly share code, notes, and snippets.

View gvsmirnov's full-sized avatar

Gleb Smirnov gvsmirnov

  • Bayesian Conspiracy (probably)
  • The Multiverse
View GitHub Profile
package sample;
import com.fasterxml.jackson.core.JsonFactory;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonToken;
import org.openjdk.jmh.annotations.*;
import java.io.IOException;
public class DummyParserBenchmark {
package sample;
import com.fasterxml.jackson.core.JsonFactory;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonToken;
import org.openjdk.jmh.annotations.*;
import java.io.IOException;
public class DummyParserBenchmark {

Correspondence between Sun/Oracle JDK, OpenJDK and HotSpot VM versions

build date Sun/Oracle JDK Version OpenJDK Version HotSpot VM Version
2006-11-29 1.6.0-b105 1.6.0-b105
2007-03-14 1.6.0_01-b06 1.6.0_01-b06
2007-06-22 1.6.0_02-b05 1.6.0_02-b05
2007-09-24 1.6.0_03-b05 1.6.0_03-b05
2007-12-14 1.6.0_04-b12 10.0-b19
@gvsmirnov
gvsmirnov / EscapingThisFromConstructorTest.java
Last active August 29, 2015 14:19
Escaping this from constructor
package org.openjdk.jcstress.tests.finals;
import org.openjdk.jcstress.annotations.*;
import org.openjdk.jcstress.infra.results.IntResult2;
import org.openjdk.jcstress.infra.results.IntResult4;
@JCStressTest
@State
@Outcome(id = "[0, 0, 0, 0]", expect = Expect.ACCEPTABLE, desc = "Neither of the escaped writes is observed")
@Outcome(id = "[1, 42, 1, 42]", expect = Expect.ACCEPTABLE, desc = "Both of the escaped writes are observed, and the write to the final field is observed in both cases")
/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/bin/java -XX:+UseG1GC -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -Xmx2g -Didea.launcher.port=7534 "-Didea.launcher.bin.path=/Applications/IntelliJ IDEA 15.app/Contents/bin" -Dfile.encoding=UTF-8 -classpath "/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/jre/lib/deploy.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/jre/lib/ext/cldrdata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/jre/lib/ext/dnsns.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/jre/lib/ext/jaccess.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/jre/lib/ext/jfxrt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/jre/lib/ext/localedata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/jre/lib/ext/nashorn.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Content
Process: idea [69393]
Path: /Applications/IntelliJ IDEA 15.app/Contents/MacOS/idea
Identifier: com.jetbrains.intellij
Version: 15.0.2 (IU-143.1184.17)
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: idea [69393]
User ID: 501
Date/Time: 2016-01-13 23:05:45.587 +0200
Process: idea [1324]
Path: /Applications/IntelliJ IDEA 15.app/Contents/MacOS/idea
Identifier: com.jetbrains.intellij
Version: 15.0.2 (IU-143.1184.17)
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: idea [1324]
User ID: 501
Date/Time: 2016-01-14 13:09:47.341 +0200
Process: idea [13368]
Path: /Applications/IntelliJ IDEA 15.app/Contents/MacOS/idea
Identifier: com.jetbrains.intellij
Version: 15.0.2 (IU-143.1184.17)
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: idea [13368]
User ID: 501
Date/Time: 2016-01-18 10:55:49.837 +0200
@gvsmirnov
gvsmirnov / fix.diff
Created January 31, 2016 17:45
Boxing Fixed
7c7
< private static volatile Double sensorValue;
---
> private static volatile double sensorValue = Double.NaN;
15,16c15,16
< private static void processSensorValue(Double value) {
< if(value != null) {
---
> private static void processSensorValue(double value) {
> if(!Double.isNaN(value)) {
@gvsmirnov
gvsmirnov / Oom.java
Last active January 6, 2017 17:31
Garbage Collection Considered Harmful
import java.util.*;
public class Oom {
public static void main(String[] args) {
List<Object> sink = new ArrayList<>();
while(true) {
sink.add(new Object());
}
}