Can anyone familiar with Dart to JS explain what is going on with:
var B=new dart
delete B.x
var C=new dart
delete C.x
...Can anyone familiar with Dart to JS explain what is going on with:
var B=new dart
delete B.x
var C=new dart
delete C.x
...These hidden classes are built on the fly: say you add `x` to a instance to get an object with a configuration that was never seen before. In that case, the engine creates a new description with that new field and remembers the transition (so that further objects with similar configurations can reuse the same hidden class).
Keeping track of these hidden classes takes time and space. If you actually use the JS object as a hashtable, then there will be lots of unnecessary hidden classes, that will never be used again. However, there is a trick to tell the engine that an object is actually a hashtable (and shouldn't be optimized as if it was an instance of a class): when deleting a field from an object v8 (and probably all other engines) assume that the object is used as a hashtable and don't create these hidden classes anymore.
Dart2js uses this trick to avoid this cost some important big hashtables (`B`, `C`, ...).