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
2 changes: 1 addition & 1 deletion protostream/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ THE POSSIBILITY OF SUCH DAMAGE.
Name of the benchmark Uber-JAR to generate.
-->
<uberjar.name>protostream-benchmark</uberjar.name>
<protostream.version>6.0.0.Dev06</protostream.version>
<protostream.version>6.0.0-SNAPSHOT</protostream.version>
</properties>

<build>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
package org.infinispan.protostream;

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.util.UUID;
import java.util.concurrent.TimeUnit;

import org.infinispan.protostream.impl.RandomAccessOutputStreamImpl;
import org.infinispan.protostream.impl.TagWriterImpl;
import org.infinispan.protostream.state.AddressState;
Expand All @@ -21,11 +26,6 @@
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.annotations.Warmup;

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.util.UUID;
import java.util.concurrent.TimeUnit;

@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
@Warmup(iterations = 3, time = 10)
Expand All @@ -46,6 +46,15 @@ public Object testSizedAddress(ContextState contextState, AddressState addressSt
return sizedWriter;
}

@Benchmark
public Object testSizeEstimateAddress(ContextState contextState, AddressState addressState) throws IOException {
SerializationContext ctx = contextState.getCtx();
Address address = addressState.getAddress();
TagWriterImpl sizedWriter = TagWriterImpl.newInstanceSizeEstimate(ctx);
WrappedMessage.write(ctx, sizedWriter, address);
return sizedWriter;
}

@Benchmark
public Object testMarshallAddress(ContextState contextState, AddressState addressState) throws IOException {
RandomAccessOutputStreamImpl raos = contextState.getOutputStream();
Expand All @@ -68,6 +77,15 @@ public Object testSizedUser(ContextState contextState, UserState userState) thro
return sizedWriter;
}

@Benchmark
public Object testSizeEstimateUser(ContextState contextState, UserState userState) throws IOException {
SerializationContext ctx = contextState.getCtx();
User user = userState.getUser();
TagWriterImpl sizedWriter = TagWriterImpl.newInstanceSizeEstimate(ctx);
WrappedMessage.write(ctx, sizedWriter, user);
return sizedWriter;
}

@Benchmark
public Object testMarshallUser(ContextState contextState, UserState userState) throws IOException {
RandomAccessOutputStreamImpl raos = contextState.getOutputStream();
Expand All @@ -90,6 +108,15 @@ public Object testSizedIracMetadata(ContextState contextState, MetadataState met
return sizedWriter;
}

@Benchmark
public Object testSizeEstimateIracMetadata(ContextState contextState, MetadataState metadataState) throws IOException {
SerializationContext ctx = contextState.getCtx();
IracMetadata metadata = metadataState.getMetadata();
TagWriterImpl sizedWriter = TagWriterImpl.newInstanceSizeEstimate(ctx);
WrappedMessage.write(ctx, sizedWriter, metadata);
return sizedWriter;
}

@Benchmark
public Object testMarshallIracMetadata(ContextState contextState, MetadataState metadataState) throws IOException {
RandomAccessOutputStreamImpl raos = contextState.getOutputStream();
Expand All @@ -112,6 +139,15 @@ public Object testSizedUUID(ContextState contextState, UUIDState uuidState) thro
return sizedWriter;
}

@Benchmark
public Object testSizeEstimateUUID(ContextState contextState, UUIDState uuidState) throws IOException {
var ctx = contextState.getCtx();
var uuid = uuidState.getUuid();
var sizedWriter = TagWriterImpl.newInstanceSizeEstimate(ctx);
WrappedMessage.write(ctx, sizedWriter, uuid);
return sizedWriter;
}

@Benchmark
public Object testMarshallUUID(ContextState contextState, UUIDState uuidState) throws IOException {
var raos = contextState.getOutputStream();
Expand Down