Skip to content

Instantly share code, notes, and snippets.

View Compression.java
package compression;
import java.util.Arrays;
import java.util.function.Supplier;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
public class Compression {
public static String compress1(String input) {
@plevart
plevart / Try.java
Created Nov 6, 2021
Functional-style resource construction/consumption/destruction with checked exception handling
View Try.java
package io;
import java.util.function.BiFunction;
import java.util.function.Function;
/**
* Instances of this class are used for handling {@link ResourceConstructor construction},
* {@link Res#applyAndDispose(Function) consumption with automatic destruction} and
* {@link Res#apply(BiFunction)} consumption with arranged destruction}
* of resources. They encapsulate logic to destruct resources and wrap checked
View reflect-stable.json
[
{
"jmhVersion" : "1.29",
"benchmark" : "si.pele.jmh.ReflectionSpeedBenchmark.constructorConst",
"mode" : "avgt",
"threads" : 1,
"forks" : 1,
"jvm" : "/home/peter/work/jdk/jdk-stable/bin/java",
"jvmArgs" : [
],
View reflect-base.json
[
{
"jmhVersion" : "1.29",
"benchmark" : "si.pele.jmh.ReflectionSpeedBenchmark.constructorConst",
"mode" : "avgt",
"threads" : 1,
"forks" : 1,
"jvm" : "/home/peter/work/jdk/jdk-base/bin/java",
"jvmArgs" : [
],
View reflect-stable.json
[
{
"jmhVersion" : "1.29",
"benchmark" : "si.pele.jmh.ReflectionSpeedBenchmark.instanceFieldConst",
"mode" : "avgt",
"threads" : 1,
"forks" : 1,
"jvm" : "/home/peter/work/jdk/jdk-stable/bin/java",
"jvmArgs" : [
],
View reflect-base.json
[
{
"jmhVersion" : "1.29",
"benchmark" : "si.pele.jmh.ReflectionSpeedBenchmark.instanceFieldConst",
"mode" : "avgt",
"threads" : 1,
"forks" : 1,
"jvm" : "/home/peter/work/jdk/jdk-base/bin/java",
"jvmArgs" : [
],
View ReflectionJacksonBenchmark.java
/*
OpenJDK 18+9 - default
Benchmark Mode Cnt Score Error Units
ReflectionJacksonBenchmark.deserializeFields avgt 10 385.381 ± 8.143 ns/op
ReflectionJacksonBenchmark.deserializeMethods avgt 10 400.039 ± 4.914 ns/op
ReflectionJacksonBenchmark.serializeFields avgt 10 256.525 ± 2.686 ns/op
ReflectionJacksonBenchmark.serializeMethods avgt 10 257.759 ± 1.755 ns/op
View jackson-peter+vh2mh.json
[
{
"jmhVersion" : "1.29",
"benchmark" : "si.pele.jmh.ReflectionJacksonBenchmark.deserializeFields",
"mode" : "avgt",
"threads" : 1,
"forks" : 1,
"jvm" : "/home/peter/work/jdk/jdk-peter-vh2mh/bin/java",
"jvmArgs" : [
],
View jackson-mandy.json
[
{
"jmhVersion" : "1.29",
"benchmark" : "si.pele.jmh.ReflectionJacksonBenchmark.deserializeFields",
"mode" : "avgt",
"threads" : 1,
"forks" : 1,
"jvm" : "/home/peter/work/jdk/jdk-mandy/bin/java",
"jvmArgs" : [
],
View jackson-jdk18+9.json
[
{
"jmhVersion" : "1.29",
"benchmark" : "si.pele.jmh.ReflectionJacksonBenchmark.deserializeFields",
"mode" : "avgt",
"threads" : 1,
"forks" : 1,
"jvm" : "/home/peter/work/jdk/jdk-18+9/bin/java",
"jvmArgs" : [
],