Skip to content

Instantly share code, notes, and snippets.

View GsonBenchmark.java
package org.qwwdfsad.benchmarks;
import com.google.gson.Gson;
import org.openjdk.jmh.annotations.*;
import java.util.concurrent.TimeUnit;
@BenchmarkMode(Mode.Throughput)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
@Threads(8)
View results.txt
32 stripes, 8u72, 32-cores Xeon with disabled hyper-threading
taskset -c 0-3 java -jar microbenchmarks.jar CountersBenchmark -bm avgt -tg 1,3
Benchmark (counterType) Mode Cnt Score Error Units
CountersBenchmark.rw AtomicLong avgt 20 108.288 ± 9.195 ns/op
CountersBenchmark.rw:get AtomicLong avgt 20 27.755 ± 4.454 ns/op
CountersBenchmark.rw:inc AtomicLong avgt 20 135.132 ± 10.859 ns/op
CountersBenchmark.rw LongAdder avgt 20 48.061 ± 1.584 ns/op
CountersBenchmark.rw:get LongAdder avgt 20 75.350 ± 3.876 ns/op
View inc.asm
Code:
[Entry Point]
[Constants]
# {method} {0x0000000125c23120} 'inc' '()V' in 'org/jctools/counters/FixedSizeStripedLongCounterV8'
# [sp+0x30] (sp of caller)
0x000000010c7de2a0: mov 0x8(%rsi),%r10d
0x000000010c7de2a4: shl $0x3,%r10
0x000000010c7de2a8: cmp %r10,%rax
0x000000010c7de2ab: jne 0x000000010c6e6e20 ; {runtime_call}
0x000000010c7de2b1: data32 xchg %ax,%ax
View BitSetFillFactorBenchmark.java
package ru.qwwdfsad.benchmarks;
import org.apache.lucene.util.OpenBitSet;
import org.openjdk.jmh.annotations.*;
import java.util.BitSet;
import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.TimeUnit;
@BenchmarkMode(Mode.Throughput)
@qwwdfsad
qwwdfsad / BitSetBenchmark.java
Last active May 10, 2016
BitSet vs OpenBitSet performance
View BitSetBenchmark.java
package ru.qwwdfsad.benchmarks;
import org.apache.lucene.util.OpenBitSet;
import org.openjdk.jmh.annotations.*;
import java.util.BitSet;
import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.TimeUnit;
@BenchmarkMode(Mode.Throughput)
View heapRegion.patch
diff --git a/src/share/vm/gc/g1/g1EvacFailure.cpp b/src/share/vm/gc/g1/g1EvacFailure.cpp
--- a/src/share/vm/gc/g1/g1EvacFailure.cpp
+++ b/src/share/vm/gc/g1/g1EvacFailure.cpp
@@ -216,14 +216,14 @@
}
bool doHeapRegion(HeapRegion *hr) {
- bool during_initial_mark = _g1h->collector_state()->during_initial_mark_pause();
- bool during_conc_mark = _g1h->collector_state()->mark_in_progress();
-
View java8.results
# Run complete. Total time: 00:04:12
Benchmark (power) Mode Cnt Score Error Units
PowBenchmark2.cross 2 avgt 5 3.318 ± 0.257 ns/op
PowBenchmark2.cross 3 avgt 5 3.929 ± 0.362 ns/op
PowBenchmark2.cross 4 avgt 5 5.105 ± 0.329 ns/op
PowBenchmark2.cross 5 avgt 5 6.392 ± 0.888 ns/op
PowBenchmark2.cross 6 avgt 5 6.109 ± 0.910 ns/op
PowBenchmark2.cross 7 avgt 5 6.497 ± 0.800 ns/op
PowBenchmark2.cross 8 avgt 5 6.791 ± 0.862 ns/op
View ContainsBenchmark.kt
package org.qwwdfsad.benchmarks
import org.openjdk.jmh.annotations.*
import java.util.concurrent.TimeUnit
/**
* @author Tolstopyatov Vsevolod
* @since 29/09/16
*/
@Fork(value = 2) //jvmArgsAppend = arrayOf("-XX:TieredStopAtLevel=1"))
View Main.java
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.TimeUnit;
import java.util.function.Supplier;
public class Main {
volatile Object consumer;
View JavaStringBenchmark.java
package org.qwwdfsad.benchmarks;
import org.openjdk.jmh.annotations.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.IntStream;
/**
* @author Tolstopyatov Vsevolod
* @since 01/10/16