Clarification around WL.scene.reserveObjects() behaviour

A few questions

  1. WIll the reservedObjects pool be used when adding objects via WL.scene.append (or only when addObject)

  2. Is the reserveObejcts pool used if the objects being added have FEWER than the specified component count when initially reserving?

  3. Does using objects from the reserveObjects pool mean that the scenegraph count number and bytes used
    e.g. Create scenegraph with 15166 / 15236 objects, 1560553 bytes
    will not keep going up if objects are reused after a Destroy?
    (As seen in the console log)

Hi @yin-chien_Yeap !

Yes, what is reserved with reserveObjects is used by anything that creates objects. Though, .append() already has highly efficient allocation behavior, which is equivalent to a reserve with the exact amount of objects that are going to be loaded.

Though, if you are loading many small scenes with .append(), then yes, reserving upfront will gain a bit of performance over not reserving.

Yes, the pools for components versus objects are separate pools, fully independent.

Exactly, reserve bumps the byte number and max object number, the first number is the amount of objects in use.