You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ro...@apache.org on 2018/08/10 10:33:42 UTC
qpid-proton-j git commit: PROTON-1911: add JMH test of encoding
message with various elements of string metadata and payload
Repository: qpid-proton-j
Updated Branches:
refs/heads/master 9b1bb4858 -> b5ef5e625
PROTON-1911: add JMH test of encoding message with various elements of string metadata and payload
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton-j/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton-j/commit/b5ef5e62
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton-j/tree/b5ef5e62
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton-j/diff/b5ef5e62
Branch: refs/heads/master
Commit: b5ef5e625fa21537bbe8aae574684368e31d252e
Parents: 9b1bb48
Author: Robbie Gemmell <ro...@apache.org>
Authored: Fri Aug 10 11:31:53 2018 +0100
Committer: Robbie Gemmell <ro...@apache.org>
Committed: Fri Aug 10 11:31:53 2018 +0100
----------------------------------------------------------------------
.../qpid/proton/message/StringsBenchmark.java | 26 ++++++++++++++++++++
1 file changed, 26 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/b5ef5e62/tests/performance-jmh/src/main/java/org/apache/qpid/proton/message/StringsBenchmark.java
----------------------------------------------------------------------
diff --git a/tests/performance-jmh/src/main/java/org/apache/qpid/proton/message/StringsBenchmark.java b/tests/performance-jmh/src/main/java/org/apache/qpid/proton/message/StringsBenchmark.java
index 00a92cc..77f70a8 100644
--- a/tests/performance-jmh/src/main/java/org/apache/qpid/proton/message/StringsBenchmark.java
+++ b/tests/performance-jmh/src/main/java/org/apache/qpid/proton/message/StringsBenchmark.java
@@ -17,6 +17,7 @@
package org.apache.qpid.proton.message;
+import org.apache.qpid.proton.amqp.messaging.AmqpValue;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.infra.Blackhole;
@@ -26,18 +27,27 @@ import java.nio.ByteBuffer;
public class StringsBenchmark extends MessageBenchmark
{
+ private static final String PAYLOAD = "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789"
+ + "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789"
+ + "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789"
+ + "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789"
+ + "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789";
private Blackhole blackhole;
private String string1;
private String string2;
private String string3;
+ private Message message;
+ private byte[] buffer = new byte[8096];
+
@Setup
public void init(Blackhole blackhole)
{
this.blackhole = blackhole;
super.init();
initStrings();
+ initStringMessage();
encode();
}
@@ -48,6 +58,15 @@ public class StringsBenchmark extends MessageBenchmark
string3 = new String("String-3");
}
+ private void initStringMessage()
+ {
+ message = Message.Factory.create();
+ message.setAddress("destination");
+ message.setMessageId("my-message-id");
+ message.setReplyTo("reply-destination");
+ message.setBody(new AmqpValue(PAYLOAD));
+ }
+
@Benchmark
@Override
public ByteBuffer encode()
@@ -70,6 +89,13 @@ public class StringsBenchmark extends MessageBenchmark
return byteBuf;
}
+ @Benchmark
+ public byte[] encodeStringMessage()
+ {
+ message.encode(buffer, 0, buffer.length);
+ return buffer;
+ }
+
public static void main(String[] args) throws RunnerException
{
runBenchmark(StringsBenchmark.class);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org