Bug 1326 - ArrayList usage that results in very slow removeChild calls
Summary: ArrayList usage that results in very slow removeChild calls
Status: RESOLVED FIXED
Alias: None
Product: Java3D
Classification: General
Component: core (show other bugs)
Version: 2.4.0
Hardware: All all
: P4 minor
Assignee: Phil Jordan
URL:
Depends on:
Blocks:
 
Reported: 2016-10-17 05:44 CEST by Phil Jordan
Modified: 2019-03-29 14:19 CET (History)
1 user (show)

See Also:
Type: DEFECT
SCM Refs:
Workaround: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Phil Jordan 2016-10-17 05:44:45 CEST
There is the use of ArrayList in a manner that is very slow when removals or clear are called.

Specifically:
NodeComponentRetained.users variable is slow when used in the methods
copyMirrorUsers
removeMirrorUsers
removeUser


RenderBin.lockGeometryList and 
RenderBin.nodeComponentList variables are slow when used in the methods
lockGeometry
releaseGeometry


My solution is two fold
1. To minimize the impact is to create a new class  that extends ArrayList<E> but internally stores the data in a LinkedHashSet, allowing faster get and remove performance
2. to alter the calls to utilize addAll and removeAll methods that are fast.

However this requires the addition of a new data class that may confuse users, a cleaner though having more impact solution would be to simply change the type from ArrayList to LinkedHashMap
Comment 1 Phil Jordan 2016-10-17 06:19:33 CEST
Also these slow arraylists are used here
Shape3DRetained.getGeomAtomsList 
and so that must be altered to accomadate any changes
Comment 2 Phil Jordan 2016-11-01 09:50:16 CET
resolved in 1.7.0