Skip to content

Instantly share code, notes, and snippets.

@skuro
Created September 20, 2011 08:46
Show Gist options
  • Save skuro/1228666 to your computer and use it in GitHub Desktop.
Save skuro/1228666 to your computer and use it in GitHub Desktop.
Perf issue
// just to show the calls in the wtf.java file
public String getId() {
return id;
}
// How come this sucks 100% CPU time?
/**
* Adds an object info.
*/
public void addObjectInfo(ObjectInfo objectInfo) {
if (!addObjectInfos) {
return;
}
if (objectInfo != null && objectInfo.getId() != null) {
getObjectInfoMap().put(objectInfo.getId(), objectInfo);
}
}
/**
* Returns the object info map.
*/
private Map<String, ObjectInfo> getObjectInfoMap() {
if (objectInfoMap == null) {
objectInfoMap = new HashMap<String, ObjectInfo>();
}
return objectInfoMap;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment