diff options
author | Kevin Rushforth <[email protected]> | 2007-06-18 22:15:49 +0000 |
---|---|---|
committer | Kevin Rushforth <[email protected]> | 2007-06-18 22:15:49 +0000 |
commit | a5863e6497fdad326e36b75ee275079be0e3713b (patch) | |
tree | 6ac53d47c3b0d2b9417f7c68f50d9ee82a6c6b4b /src | |
parent | 824168fbeb789d8232d3b4704c8750b31a811376 (diff) |
Fix issue 496: Big performance hit in VirtualUniverse.getNodeId
git-svn-id: https://svn.java.net/svn/j3d-core~svn/trunk@855 ba19aa83-45c5-6ac9-afd3-db810772062c
Diffstat (limited to 'src')
-rw-r--r-- | src/classes/share/javax/media/j3d/VirtualUniverse.java | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/classes/share/javax/media/j3d/VirtualUniverse.java b/src/classes/share/javax/media/j3d/VirtualUniverse.java index f8f736f..3928908 100644 --- a/src/classes/share/javax/media/j3d/VirtualUniverse.java +++ b/src/classes/share/javax/media/j3d/VirtualUniverse.java @@ -609,8 +609,10 @@ public class VirtualUniverse extends Object { str = Long.toString(nodeIdCount); nodeIdCount++; } else { - str = (String) nodeIdFreeList.lastElement(); - nodeIdFreeList.removeElement(str); + // Issue 496: Remove last object using index to avoid performance + // hit of a needless linear search. + int idx = nodeIdFreeList.size() - 1; + str = (String) nodeIdFreeList.remove(idx); } return(str); } |