-
Notifications
You must be signed in to change notification settings - Fork 39
Open
Description
Scenario
When we have millions of Shape3D objects, the BH tree construction take GeometryStructure.getOrAddBHTreeIndex. Then, the first rendering time is much slow.
| private int getOrAddBHTreeIndex(Locale locale) { |
The main reason is the array grow up algorithm is not
Expected
private int getOrAddBHTreeIndex(Locale locale) {
int i;
for (i=0; i< bhTreeCount; i++) {
if (bhTreeArr[i].locale == locale)
return i;
}
if (bhTreeCount >= bhTreeMax) {
// allocate a bigger array here....
if (J3dDebug.devPhase)
J3dDebug.doDebug(J3dDebug.geometryStructure, J3dDebug.LEVEL_2,
"Expanding bhTreeArr array ...\n");
bhTreeMax += bhTreeMax >> 1;
BHTree[] oldBhTreeArr = bhTreeArr;
bhTreeArr = new BHTree[bhTreeMax];
System.arraycopy(oldBhTreeArr, 0, bhTreeArr, 0, oldBhTreeArr.length);
}
bhTreeArr[bhTreeCount] = new BHTree(locale);
bhTreeCount++;
return i;
}Metadata
Metadata
Assignees
Labels
No labels