Save 1.3 GB of RAM with finalizeCacheableObjectPrototype #592
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Rewrites the guts of CacheableObject so that property setters/getters are configured on each subclass' prototype, rather than on each instance. In practice this obliterates many hundreds of thousands of thin wrappers around
compute
/transform
behavior defined in properties' descriptors. That saves a lot of memory! There also appear to be speed improvements (in general around 20s to boot live-dev-server, against 30s, on miniminimini/M1).This approach was suggested by natalias posting. She also wrote the code for tracking total process memory usage at each step, which we've put behind
--show-step-memory
(used alongside--show-step-summary
).We have generally replaced
Object.hasOwn(thing, 'key')
behavior withthing.constructor.hasPropertyDescriptor('key')
. Listings need a bit of mockery to make this work, until they're made into proper things. (Nudge nudge #424)External behavior and interfacing for CacheableObject is otherwise identical... except that we now only mark a cached value as, you know, cached, if we were successfully able to compute it. That means if
foo.x
throws an error, accessingfoo.x
again will throw the same error again, instead of just returningundefined
(the "successfully" cached value). This has no bearing on general wiki code but should make debugging on the REPL a bit nicer.