Nu having to create half a million objects the moment a single 3D entity is placed in the scene is wasteful in terms of memory as well as potentially what the GC may have to scan.
Let's try our best to make this structure lazily constructed. For hashed node access, we can just check for null nodes before peeking into them in the fast path.
Lazy construction does have a down-side: unlike preconstructing all the octnodes, they won't be placed so closely in memory. This may or may not have measurable performance implications for access time. But either way, it's worth a try if we can make it work.
Nu having to create half a million objects the moment a single 3D entity is placed in the scene is wasteful in terms of memory as well as potentially what the GC may have to scan.
Let's try our best to make this structure lazily constructed. For hashed node access, we can just check for null nodes before peeking into them in the fast path.
Lazy construction does have a down-side: unlike preconstructing all the octnodes, they won't be placed so closely in memory. This may or may not have measurable performance implications for access time. But either way, it's worth a try if we can make it work.