[ 
https://issues.apache.org/jira/browse/ARTEMIS-2604?focusedWorklogId=375756&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-375756
 ]

ASF GitHub Bot logged work on ARTEMIS-2604:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 22/Jan/20 17:26
            Start Date: 22/Jan/20 17:26
    Worklog Time Spent: 10m 
      Work Description: franz1981 commented on pull request #2950: ARTEMIS-2604 
Save Message decoding when unnecessary
URL: https://github.com/apache/activemq-artemis/pull/2950#discussion_r369697534
 
 

 ##########
 File path: 
artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/TypedProperties.java
 ##########
 @@ -372,6 +372,79 @@ private synchronized void 
forEachInternal(BiConsumer<SimpleString, PropertyValue
       }
    }
 
+   /**
+    * Performs a search among the valid key properties contained in {@code 
buffer}, starting from {@code from}
+    * assuming it to be a valid encoded {@link TypedProperties} content.
+    *
+    * @throws IllegalStateException if any not-valid property is found while 
searching the {@code key} property
+    */
+   public static boolean searchProperty(SimpleString key, ByteBuf buffer, int 
startIndex) {
 
 Review comment:
   Re your comments
   
   > You're still parsing the key at its exact position.
   
   Nope: to compare `SimpleString` and `ByteBuf` is using another optimized 
method I've implemented some time ago that allow to compare them very quickly 
directly ie 
https://github.com/apache/activemq-artemis/blob/0293d8057441e6bfeb9e6533774862ffc86d74eb/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/ByteUtil.java#L346-L360
   
   > in Java every time you do buffer.getInt(index) you will create a few bytes 
in memory.
   
   That's the signature of the Netty method: 
https://netty.io/4.0/api/io/netty/buffer/ByteBuf.html#getInt-int-
   
   it would return a primitive `int`: it's not allocating anything. I've taken 
care to design that method to be garbage-free :+1: 
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 375756)
    Time Spent: 4h 10m  (was: 4h)

> Save Message decoding when unnecessary
> --------------------------------------
>
>                 Key: ARTEMIS-2604
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-2604
>             Project: ActiveMQ Artemis
>          Issue Type: Improvement
>    Affects Versions: 2.12.0
>            Reporter: Francesco Nigro
>            Priority: Major
>          Time Spent: 4h 10m
>  Remaining Estimate: 0h
>
> There are few cases eg while loading journal or on common message routing
> where decoding a full message isn't necessary if certain properties aren't 
> present.
> Performing a "brute-force" scan into the message not-yet-decoded raw contant 
> would be welcome if compared to a full decoding that could be saved for later 
> (or never).



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to