Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 7 additions & 11 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions .idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

83 changes: 83 additions & 0 deletions messenger-benchmarks/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>messenger</artifactId>
<groupId>io.github.sadcenter</groupId>
<version>3.0.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>messenger-benchmarks</artifactId>

<dependencies>
<dependency>
<groupId>org.openjdk.jmh</groupId>
<artifactId>jmh-core</artifactId>
<version>1.35</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.github.sadcenter</groupId>
<artifactId>messenger-codecs</artifactId>
<version>3.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.openjdk.jmh</groupId>
<artifactId>jmh-generator-annprocess</artifactId>
<version>1.35</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.github.sadcenter</groupId>
<artifactId>messenger-core</artifactId>
<version>3.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>de.ruedigermoeller</groupId>
<artifactId>fst</artifactId>
<version>3.0.3</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.msgpack</groupId>
<artifactId>jackson-dataformat-msgpack</artifactId>
<version>0.9.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.13.3</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.13.3</version>
<scope>compile</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>--add-opens=java.base/java.lang=ALL-UNNAMED
--add-opens=java.base/java.math=ALL-UNNAMED
--add-opens=java.base/java.util=ALL-UNNAMED
--add-opens=java.base/java.util.concurrent=ALL-UNNAMED
--add-opens=java.base/java.net=ALL-UNNAMED
--add-opens=java.base/java.text=ALL-UNNAMED
--add-opens=java.sql/java.sql=ALL-UNNAMED</argLine>
</configuration>
</plugin>
</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package io.github.sadcenter.messenger;

import java.io.IOException;
import org.openjdk.jmh.Main;

public class BenchmarkApplication {

public static void main(String[] args) throws IOException {
Main.main(args);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package io.github.sadcenter.messenger.benchmarks;

import io.github.sadcenter.messenger.benchmarks.example.ExamplePacket;
import io.github.sadcenter.messenger.codec.Codec;
import io.github.sadcenter.messenger.codecs.binary.FstCodec;
import io.github.sadcenter.messenger.codecs.binary.MessagePackCodec;
import io.github.sadcenter.messenger.codecs.json.JacksonCodec;
import java.lang.ref.PhantomReference;
import java.util.List;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.BenchmarkMode;
import org.openjdk.jmh.annotations.Fork;
import org.openjdk.jmh.annotations.Mode;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.State;

@State(Scope.Benchmark)
public class CodecBenchmarkTest {

private final ExamplePacket examplePacket = new ExamplePacket("Kacper", "Krzychala", 14);

private final JacksonCodec jacksonCodec = new JacksonCodec();
private final MessagePackCodec msgPackCodec = new MessagePackCodec();


@Benchmark
@BenchmarkMode(Mode.Throughput)
@Fork(value = 1)
public void benchJacksonSerialization() {
jacksonCodec.encode(examplePacket);
}

@Benchmark
@BenchmarkMode(Mode.Throughput)
@Fork(value = 1)
public void benchMessagePackSerialization() {
msgPackCodec.encode(examplePacket);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package io.github.sadcenter.messenger.benchmarks;

public class MessengerBenchmarkTest {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package io.github.sadcenter.messenger.benchmarks.example;

import io.github.sadcenter.messenger.packet.Packet;
import java.util.Objects;

public class ExamplePacket extends Packet {

private final String name, surname;
private final int age;

public ExamplePacket(String name, String surname, int age) {
this.name = name;
this.surname = surname;
this.age = age;
}

@Override
public String toString() {
return "ExamplePacket{" +
"name='" + name + '\'' +
", surname='" + surname + '\'' +
", age=" + age +
'}';
}

@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ExamplePacket that = (ExamplePacket) o;
return age == that.age && Objects.equals(name, that.name) && Objects.equals(
surname, that.surname);
}

@Override
public int hashCode() {
return Objects.hash(name, surname, age);
}
}
74 changes: 0 additions & 74 deletions messenger-codec-fst/pom.xml

This file was deleted.

Loading