[
https://issues.jboss.org/browse/JGRP-2042?page=com.atlassian.jira.plugin....
]
Bela Ban commented on JGRP-2042:
--------------------------------
The problem is that you cannot avoid the lookup altogether because the mapping between
magic IDs and classes is defined in {{jg-magic-map.xml}}. So either the lookup is done at
header creation time, or at serialization time; the cost is the same (1 lookup).
If each header class defined its own constant magic ID, that would work, but I don't
want to do that as we'd have to make sure all header IDs are unique...
Improve performance of Message#writeHeader
------------------------------------------
Key: JGRP-2042
URL:
https://issues.jboss.org/browse/JGRP-2042
Project: JGroups
Issue Type: Enhancement
Reporter: Sanne Grinovero
Assignee: Bela Ban
Priority: Minor
Fix For: 3.6.11, 4.0
The following stacktrace, taken with JFR, is highlighting a CPU consumer which could be
optimised.
{noformat}Stack Trace Sample Count Percentage(%)
java.util.IdentityHashMap.get(Object) 66 2.224
org.jgroups.conf.ClassConfigurator.getMagicNumber(Class) 66 2.224
org.jgroups.Message.writeHeader(Header, DataOutput) 66 2.224
{noformat}
One idea could be to use an ad-hoc implementation of Map which takes advantage of the key
being a {{Class}}. An interesting alternative would be to avoid the map lookup altogether,
by having the Header expose a method like "writeMagicNumber(DataInput to)".
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)