« get me outta code hell

data, infra: better CacheableObject prototype inheritence - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/data/composite/things/content/helpers/withExpressedOrImplicitArtistReferences.js
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2025-11-19 22:34:17 -0400
committer(quasar) nebula <qznebula@protonmail.com>2025-11-25 07:06:48 -0400
commitaefb53631314295e1574847683bbfa5fec98d536 (patch)
tree3080a14161af7ce9d2beea7da540700fd8dcfc9f /src/data/composite/things/content/helpers/withExpressedOrImplicitArtistReferences.js
parent0b963b6e6b4f90c80e7369a804407f32e69c7ede (diff)
data, infra: better CacheableObject prototype inheritence
Basically, properties (as written in source code) are only
registered once EVER, instead of "also" on subclasses, which
was previously the case - we were literally copying over the
descriptors and then re-evaluating as  though they were new.

That's the goal, but to make it happen, we had to redo how
default property values are initialized. Things no longer self-
prepare by making a "storage" for all their cached values with
null, or defaults, filled in - instead they create a new object
which inherits those defaults from their prototype. This object
respectively has the prototype of the superclass' prototype's
defaults, and so on. A nice effect is that validating defaults
against update.validate specs now happens during prototype
finalization, instead of every time any instance is instantiated.

We also had to do the same kind of inheritence shenanigans
with the full propertyDescriptors specs themselves.

The real-world performance boost for this is probably more
or less zero RIGHT NOW, because Thing subclassing is used
crazy sparingly (and there's still work to make it really nice).
But if [[Prototype]] chains don't really take memory, then
possibly this cleans up a lot of extremely similar objects
where every new Thing property multiplies memory usage
across all instances of that thing, regardless how few actually
set a value. Maybe! Who knows what V8 really optimizes,
but maybe!
Diffstat (limited to 'src/data/composite/things/content/helpers/withExpressedOrImplicitArtistReferences.js')
0 files changed, 0 insertions, 0 deletions