Track static parts of the generated VDOM #116
Closed
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.
This pull request modifies how the
hfunctions are called (in the non-mini build) in order to track whether the element evaluated byhis static. When we talk about static elements in this context we mean elements whose tag or props are not in any way based on dynamic values. Text nodes are static if their text is not based on a dynamic value.In
hfunction calls made by HTMthiswill be a number. The number's two lowest bits are used to signal the following things:his currently evaluating is static. The element's descendants may or may not be static.In practice this means that
h'sthiswill be0b00when the element itself and one or more of its descendants is based on dynamic values. Conversely,thiswill be0b11when the element itself and all of its (zero or more) descendants are static. When the element itself is static but has dynamic descendantsthiswill be0b01, and when the element itself is dynamic but all of its (zero or more) descendants are staticthiswill be0b10.This pull request also adds some rudimentary tests for statics tracking. The size of the Brotli-compressed
htm.module.js.brincreases by 24 bytes (596 B -> 620 B). The highest results in the "usage" benchmark are less than 2% lower compared to the master branch's highest results.