Initiate all potential props of the object right away or as you go?

I’m my scenario I have to create a lot of objects (100k+). Those objects can ‘evolve’ in the course if their life. Some will stay practically unchanged, others with will mutate and have a bunch of props assigned.

The most evolved objects might have 30+ properties.

All object are just data, no function, no logic.

From performance point of view, should I use:

const obj = Object.create(null)

obj.prop1 = ...;
obj.prop2 = ...;

//later

obj.prop3 = ...;

//later still

obj.prop4 = ...;

or

cost obj = {
    prop1 = ...;
    prop2 = ...;

    prop3 = undefined;
    prop4 = undefined;
}

Or just define the class and use new.

I’m considering the first approach because:

  1. there might be some memory savings with null prototype (and smaller hashtable?)
  2. it is nicer to iterate over object properties without doing ‘hasOwnProperty’.
  3. Also it will be easier for me to debug without a bunch of undefined properties hanging on the list in IDE/DevTools.

At the same time, I vaguely remember that v8 was doing some JIT magic with compilation of objects, but if I continue to add properties overtime, that this optimization could go out of the window.

Which option is better from memory usage and/or performance point of view?