[
https://issues.apache.org/jira/browse/ARTEMIS-2170?focusedWorklogId=188056&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-188056
]
ASF GitHub Bot logged work on ARTEMIS-2170:
-------------------------------------------
Author: ASF GitHub Bot
Created on: 22/Jan/19 09:08
Start Date: 22/Jan/19 09:08
Worklog Time Spent: 10m
Work Description: michaelandrepearce commented on issue #2427:
ARTEMIS-2170 Optimized CoreMessage's checkProperties and
cleanupInternalProperties methods
URL: https://github.com/apache/activemq-artemis/pull/2427#issuecomment-456323566
@franz1981
On the predicate logic, there is a small enhancement you could make, if you
added the following method to SimpleString
```
public boolean startsWithButNotEqual(final SimpleString other) {
//Equal so return false
if (this == other) {
return false;
}
byte[] otherdata = other.data;
if (otherdata.length > data.length) {
return false;
}
for (int i = 0; i < otherdata.length; i++) {
if (data[i] != otherdata[i]) {
return false;
}
}
//Equal so return false
if (otherdata.length == data.length) {
return false;
}
return true;
}
```
Then you could make the predicate, this would avoid having to do an equals
check if there is a match, as the equal check can be combined with the
startswith.
```
private static final Predicate<SimpleString>
INTERNAL_PROPERTY_NAMES_PREDICATE =
name -> name.startsWithButNotEqual(Message.HDR_ROUTE_TO_IDS) ||
name.startsWithButNotEqual(Message.HDR_ROUTE_TO_ACK_IDS);
```
i think its over-optimisation personally, but if you are concerned, you
could look to something like that.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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: 188056)
Time Spent: 5h 40m (was: 5.5h)
> Optimized CoreMessage's checkProperties and cleanupInternalProperties methods
> -----------------------------------------------------------------------------
>
> Key: ARTEMIS-2170
> URL: https://issues.apache.org/jira/browse/ARTEMIS-2170
> Project: ActiveMQ Artemis
> Issue Type: Improvement
> Components: Broker
> Reporter: Francesco Nigro
> Assignee: Francesco Nigro
> Priority: Minor
> Time Spent: 5h 40m
> Remaining Estimate: 0h
>
> CoreMessage::checkProperties perform too many volatile read/write and has a
> too big body just to handle exceptional cases, while
> cleanupInternalProperties is called on the hot path of session send, but is
> performing too many synchronized operations and loopup on TypedProperties.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)