Wouldnt it be faster to use UIntArrays ?

Antoine: Well, the idea was to

  1. make Arrays of Objects (AofO) smaller by making the individual O’s much smaller by having two instance layers, one shared by all the O’s in the A, and the second, top-most, being “exceptions to the rule” so to speak .. overriding the shared values.
  2. Not only save space but also have the shared approach: changing the “default” variable immediately changes it for all the Os.

Interestingly enough, we did consider an OofAs approach. Rather than having an Array with lots of Os, have a single O with a typed array for each variable. This is smaller in general, and more performant in many situations, especially when using the TAs for THREE.js/WebGL.

We still use a hybrid approach which takes a few variables and makes them stand-alone typed arrays.

Not sure if this is what you were getting at. But TAs are a Family Favorite in our team’s code!

Show your support

Clapping shows how much you appreciated Owen Densmore’s story.