Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into record-field-serial…
Browse files Browse the repository at this point in the history
…izer
  • Loading branch information
theigl committed Oct 16, 2023
2 parents 3fdfef3 + c0cc9f9 commit d8a67a5
Show file tree
Hide file tree
Showing 150 changed files with 1,842 additions and 293 deletions.
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "maven"
directory: "/"
schedule:
interval: "weekly"
7 changes: 7 additions & 0 deletions .github/workflows/ci-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ jobs:
java-version: 17
- name: Test with JDK 17
run: mvn -v && mvn -B test

- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 20
- name: Test with JDK 20
run: mvn -v && mvn -B test

- name: Set up settings.xml for Sonatype
uses: actions/setup-java@v3
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2008-2022, Nathan Sweet
Copyright (c) 2008-2023, Nathan Sweet
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Expand Down
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
![KryoNet](https://raw.github.com/wiki/EsotericSoftware/kryo/images/logo.jpg)

[![Build Status](https://travis-ci.org/EsotericSoftware/kryo.png?branch=master)](https://travis-ci.org/EsotericSoftware/kryo)
[![Build Status](https://github.com/EsotericSoftware/kryo/actions/workflows/ci-workflow.yml/badge.svg)](https://github.com/EsotericSoftware/kryo/actions/workflows/ci-workflow.yml)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.esotericsoftware/kryo/badge.svg)](http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22com.esotericsoftware%22%20AND%20a%3Akryo)
[![Join the chat at https://gitter.im/EsotericSoftware/kryo](https://badges.gitter.im/EsotericSoftware/kryo.svg)](https://gitter.im/EsotericSoftware/kryo)
[![Fuzzing Status](https://oss-fuzz-build-logs.storage.googleapis.com/badges/kryo.svg)](https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&can=1&q=proj:kryo)
Expand Down Expand Up @@ -88,6 +88,8 @@ Please use the [Kryo mailing list](https://groups.google.com/forum/#!forum/kryo-

## Recent releases

* [4.0.3](https://github.com/EsotericSoftware/kryo/releases/tag/kryo-parent-4.0.3) - brings bug fixes and performance improvements for chunked encoding.
* [5.5.0](https://github.com/EsotericSoftware/kryo/releases/tag/kryo-parent-5.5.0) - brings bug fixes and performance improvements.
* [5.4.0](https://github.com/EsotericSoftware/kryo/releases/tag/kryo-parent-5.4.0) - brings bug fixes and performance improvements.
* [5.3.0](https://github.com/EsotericSoftware/kryo/releases/tag/kryo-parent-5.3.0) - brings bug fixes and performance improvements.
* [5.2.1](https://github.com/EsotericSoftware/kryo/releases/tag/kryo-parent-5.2.1) - brings minor bug fixes and improvements.
Expand All @@ -112,7 +114,7 @@ To use the latest Kryo release in your application, use this dependency entry in
<dependency>
<groupId>com.esotericsoftware</groupId>
<artifactId>kryo</artifactId>
<version>5.4.0</version>
<version>5.5.0</version>
</dependency>
```

Expand All @@ -122,7 +124,7 @@ To use the latest Kryo release in a library you want to publish, use this depend
<dependency>
<groupId>com.esotericsoftware.kryo</groupId>
<artifactId>kryo5</artifactId>
<version>5.4.0</version>
<version>5.5.0</version>
</dependency>
```

Expand All @@ -139,13 +141,13 @@ To use the latest Kryo snapshot, use:
<dependency>
<groupId>com.esotericsoftware</groupId>
<artifactId>kryo</artifactId>
<version>5.4.1-SNAPSHOT</version>
<version>5.5.1-SNAPSHOT</version>
</dependency>
<!-- for usage in a library that should be published: -->
<dependency>
<groupId>com.esotericsoftware.kryo</groupId>
<artifactId>kryo5</artifactId>
<version>5.4.1-SNAPSHOT</version>
<version>5.5.1-SNAPSHOT</version>
</dependency>
```

Expand Down
10 changes: 5 additions & 5 deletions benchmarks/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.esotericsoftware</groupId>
<artifactId>kryo-parent</artifactId>
<version>5.4.1-SNAPSHOT</version>
<version>5.5.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand All @@ -16,8 +16,8 @@

<properties>
<kryo.root>${basedir}/..</kryo.root>
<jmh.version>1.36</jmh.version>
<byte-buddy.version>1.12.18</byte-buddy.version>
<jmh.version>1.37</jmh.version>
<byte-buddy.version>1.14.8</byte-buddy.version>
<uberjar.name>benchmarks</uberjar.name>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
Expand Down Expand Up @@ -51,7 +51,7 @@
<plugins>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.2.0</version>
<version>3.6.0</version>
<executions>
<execution>
<id>build-classpath</id>
Expand All @@ -69,7 +69,7 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.0.0</version>
<version>3.1.0</version>
<executions>
<execution>
<id>run-tests</id>
Expand Down
3 changes: 2 additions & 1 deletion benchmarks/run.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#!/usr/bin/env bash

args="-f 4 -wi 5 -i 3 -t 2 -w 2s -r 2s -rf csv -rff"
jmh="$JAVA_HOME/bin/java -cp ../bin;../lib/*;lib/* com.esotericsoftware.kryo.benchmarks.KryoBenchmarks $args"
jmh="$JAVA_HOME/bin/java -cp ../eclipse/bin;../eclipse/.apt_generated;../lib/*;lib/* com.esotericsoftware.kryo.benchmarks.KryoBenchmarks $args"

set -ex

mkdir -p charts/results
$jmh charts/results/fieldSerializer.csv FieldSerializerBenchmark
$jmh charts/results/array.csv ArrayBenchmark
$jmh charts/results/string.csv StringBenchmark
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
package com.esotericsoftware.kryo.benchmarks;

import com.esotericsoftware.kryo.Serializer;
import com.esotericsoftware.kryo.io.Input;
import com.esotericsoftware.kryo.io.Output;
import com.esotericsoftware.kryo.serializers.DefaultSerializers;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Level;
import org.openjdk.jmh.annotations.Param;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.annotations.TearDown;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.RunnerException;
import org.openjdk.jmh.runner.options.Options;
import org.openjdk.jmh.runner.options.OptionsBuilder;

import java.math.BigDecimal;

import static java.lang.Integer.parseInt;
import static java.math.BigDecimal.ONE;
import static java.math.BigDecimal.ZERO;
import static java.util.concurrent.TimeUnit.MICROSECONDS;
import static org.openjdk.jmh.runner.options.TimeValue.seconds;

public class BigDecimalBenchmark {

@State(Scope.Thread)
public static class MyState {
final Serializer<BigDecimal> serializer = new DefaultSerializers.BigDecimalSerializer();

Output output;
Input input;

@Param({
"null", "zero", "one", "0",
"2", "10", "max_in_long", "20", // twenty is more than the number of digits in Long.MAX_VALUE
"-2", "-10", "min_in_long", "-20" // twenty is more than the number of digits in Long.MIN_VALUE
})
String numOfDigits = "5";
int scale = 2;

BigDecimal decimal;

@Setup(Level.Iteration)
public void setUp() {
decimal = newDecimal(numOfDigits, scale);
output = new Output(2, -1);
serializer.write(null, output, decimal);
input = new Input(output.toBytes());
output.reset();
}

private static BigDecimal newDecimal(String numOfDigits, int scale) {
switch (numOfDigits) {
case "null": return null;
case "zero": return ZERO;
case "one": return ONE;
case "0": return BigDecimal.valueOf(0, scale);
case "max_in_long": return BigDecimal.valueOf(Long.MAX_VALUE, scale);
case "min_in_long": return BigDecimal.valueOf(Long.MIN_VALUE, scale);
default:
int digits = parseInt(numOfDigits.replace("-", ""));
BigDecimal d = BigDecimal.valueOf(10, 1 - digits).subtract(ONE).scaleByPowerOfTen(-scale); // '9' repeated numOfDigit times
return numOfDigits.charAt(0) != '-' ? d : d.negate();
}
}

@TearDown(Level.Iteration)
public void tearDown () {
output.close();
input.close();
}
}

@Benchmark
public byte[] write (MyState state) {
state.output.reset();
state.serializer.write(null, state.output, state.decimal);
return state.output.getBuffer();
}

@Benchmark
public BigDecimal read (MyState state) {
state.input.reset();
return state.serializer.read(null, state.input, BigDecimal.class);
}

public static void main (String[] args) throws RunnerException {
final Options opt = new OptionsBuilder()
.include(".*" + BigDecimalBenchmark.class.getSimpleName() + ".*")
.timeUnit(MICROSECONDS)
.warmupIterations(1)
.warmupTime(seconds(1))
.measurementIterations(4)
.measurementTime(seconds(1))
.forks(1)
.build();
new Runner(opt).run();
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
/* Copyright (c) 2008-2023, Nathan Sweet
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following
* conditions are met:
*
* - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided with the distribution.
* - Neither the name of Esoteric Software nor the names of its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */

package com.esotericsoftware.kryo.benchmarks;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2008-2022, Nathan Sweet
/* Copyright (c) 2008-2023, Nathan Sweet
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2008-2022, Nathan Sweet
/* Copyright (c) 2008-2023, Nathan Sweet
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2008-2018, Nathan Sweet
/* Copyright (c) 2008-2023, Nathan Sweet
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2008-2022, Nathan Sweet
/* Copyright (c) 2008-2023, Nathan Sweet
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2008-2022, Nathan Sweet
/* Copyright (c) 2008-2023, Nathan Sweet
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2008-2022, Nathan Sweet
/* Copyright (c) 2008-2023, Nathan Sweet
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2008-2022, Nathan Sweet
/* Copyright (c) 2008-2023, Nathan Sweet
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2008-2022, Nathan Sweet
/* Copyright (c) 2008-2023, Nathan Sweet
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2008-2022, Nathan Sweet
/* Copyright (c) 2008-2023, Nathan Sweet
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2008-2022, Nathan Sweet
/* Copyright (c) 2008-2023, Nathan Sweet
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2008-2022, Nathan Sweet
/* Copyright (c) 2008-2023, Nathan Sweet
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following
Expand Down
5 changes: 3 additions & 2 deletions build/assembly-all.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
</formats>
<fileSets>
<fileSet>
<directory>.</directory>
<includes>
<include>README*</include>
<include>license*</include>
<include>LICENCE*</include>
<include>CHANGES*</include>
<include>lib/</include>
<include>src/</include>
Expand All @@ -22,4 +23,4 @@
</includes>
</fileSet>
</fileSets>
</assembly>
</assembly>
Loading

0 comments on commit d8a67a5

Please sign in to comment.