Message from JavaScript talks

June 2017

— So this?

— 

This is how it's done for now:

// Pre-allocate character codes to empty length sets
var curCharCode = 0;
while (curCharCode <= maxCharCode) {
_list[curCharCode] = [];
curCharCode++;
}

— Problematic...

— I see

— This could be allocated on startup I think

— And then re-used across all set instances

— Oh?

— 

allocatedArray = [];
fill(allocatedArray);

class Set {
constructor() {
this.data = Object.assign([], allocatedArray);
}
}

Message permanent page

— Something like that?

— So every set re-uses the single pre-allocated master array

— And reassigns indexes which get filled?

— That is effectively the same thing