[
http://jira.jboss.com/jira/browse/JBSEAM-2192?page=all ]
Pete Muir resolved JBSEAM-2192.
-------------------------------
Resolution: Done
Done, I see containsKey now taking 10ms.
AbstractMap from org.jboss.seam.international.Messages needs
containsKey()
--------------------------------------------------------------------------
Key: JBSEAM-2192
URL:
http://jira.jboss.com/jira/browse/JBSEAM-2192
Project: JBoss Seam
Issue Type: Bug
Components: Core
Affects Versions: 2.0.0.CR2
Environment: Mac OSX, Jboss 4.2.1
Reporter: Damian Harvey
Assigned To: Pete Muir
Fix For: 2.0.1.GA
Performing a containsKey() on the AbstractMap from org.jboss.seam.international.Messages
results in severe performance problems (800ms on 1,800 properties compared to under 1ms
for a get())
eg:
@In
Map<String, String> messages; //This is the Seam messages bundle
public void aMethod() {
if(messages.containsKey("key.mykey")) {
//do something
}
}
I traced the containsKey for a while but it went on a mad run through ELResolvers and
Pages.java etc.
Simple solution is to add a containsKey to the AbstractMap:
public boolean containsKey(String key) {
if(messages.get(key).equals(key)) {
return false;
} else {
return true;
}
}
Would be nice to know why this 'mad run' happened though. Hopefully not
symptomatic of something wrong deeper down.
Cheers,
Damian.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira