You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2015/07/20 15:58:56 UTC
[1/2] activemq-artemis git commit: Avoid some array copies on STOMP
decode
Repository: activemq-artemis
Updated Branches:
refs/heads/master 94f84c43a -> 96b559307
Avoid some array copies on STOMP decode
Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/8a90de6f
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/8a90de6f
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/8a90de6f
Branch: refs/heads/master
Commit: 8a90de6fbc651dda6de7b4417ba4e94abbeb718e
Parents: 94f84c4
Author: Ville Skyttä <vi...@iki.fi>
Authored: Thu Jul 16 13:23:58 2015 +0300
Committer: Clebert Suconic <cl...@apache.org>
Committed: Mon Jul 20 14:57:17 2015 +0100
----------------------------------------------------------------------
.../artemis/core/protocol/stomp/SimpleBytes.java | 4 +---
.../artemis/core/protocol/stomp/StompDecoder.java | 12 ++----------
.../artemis/core/protocol/stomp/StompFrame.java | 5 +----
3 files changed, 4 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/8a90de6f/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/SimpleBytes.java
----------------------------------------------------------------------
diff --git a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/SimpleBytes.java b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/SimpleBytes.java
index 3d0fddc..474ea3d 100644
--- a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/SimpleBytes.java
+++ b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/SimpleBytes.java
@@ -35,10 +35,8 @@ public class SimpleBytes
public String getString()
{
if (index == 0) return "";
- byte[] realData = new byte[index];
- System.arraycopy(contents, 0, realData, 0, realData.length);
- return new String(realData, StandardCharsets.UTF_8);
+ return new String(contents, 0, index, StandardCharsets.UTF_8);
}
public void reset()
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/8a90de6f/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompDecoder.java
----------------------------------------------------------------------
diff --git a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompDecoder.java b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompDecoder.java
index d0c13d1..57ecbb2 100644
--- a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompDecoder.java
+++ b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompDecoder.java
@@ -312,11 +312,7 @@ public class StompDecoder
{
if (inHeaderName)
{
- byte[] data = new byte[pos - headerBytesCopyStart - 1];
-
- System.arraycopy(workingBuffer, headerBytesCopyStart, data, 0, data.length);
-
- headerName = new String(data);
+ headerName = new String(workingBuffer, headerBytesCopyStart, pos - headerBytesCopyStart - 1);
inHeaderName = false;
@@ -339,11 +335,7 @@ public class StompDecoder
break outer;
}
- byte[] data = new byte[pos - headerBytesCopyStart - 1];
-
- System.arraycopy(workingBuffer, headerBytesCopyStart, data, 0, data.length);
-
- String headerValue = new String(data);
+ String headerValue = new String(workingBuffer, headerBytesCopyStart, pos - headerBytesCopyStart - 1);
headers.put(headerName, headerValue);
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/8a90de6f/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompFrame.java
----------------------------------------------------------------------
diff --git a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompFrame.java b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompFrame.java
index cb6ede5..2958c98 100644
--- a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompFrame.java
+++ b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompFrame.java
@@ -229,10 +229,7 @@ public class StompFrame
iBuffer++;
}
- char[] total = new char[iBuffer];
- System.arraycopy(buffer, 0, total, 0, iBuffer);
-
- return new String(total);
+ return new String(buffer, 0, iBuffer);
}
public void setBody(String body)
[2/2] activemq-artemis git commit: This closes #84 on avoiding stomp
array copies
Posted by cl...@apache.org.
This closes #84 on avoiding stomp array copies
Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/96b55930
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/96b55930
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/96b55930
Branch: refs/heads/master
Commit: 96b559307c9f0c28839ff3e5cd54803d08cfa376
Parents: 94f84c4 8a90de6
Author: Clebert Suconic <cl...@apache.org>
Authored: Mon Jul 20 14:58:39 2015 +0100
Committer: Clebert Suconic <cl...@apache.org>
Committed: Mon Jul 20 14:58:39 2015 +0100
----------------------------------------------------------------------
.../artemis/core/protocol/stomp/SimpleBytes.java | 4 +---
.../artemis/core/protocol/stomp/StompDecoder.java | 12 ++----------
.../artemis/core/protocol/stomp/StompFrame.java | 5 +----
3 files changed, 4 insertions(+), 17 deletions(-)
----------------------------------------------------------------------