Repository navigation
Keep the pending children of a render node in its children field - #269
Merged
FlorianRappl merged 3 commits intoNov 5, 2026
Merged
Conversation
A complete render node is back to the fields it had before AngleSharp#267: the children field holds either the children or, in a partial render tree, what builds them on first read.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Follow-up to #267, for your field count there: with this a complete render node has exactly the fields it had before #267 (+0 instead of +1).
ElementRenderNode._childrennow holds either the children (a complete tree, as before) or, in a partial render tree, thePendingChildrenthat build them on first read.PendingChildrenalso caches the children it builds, with the sameVolatile.Read+Interlocked.CompareExchangepublish as before.Childrencosts one type check against a sealed class.No public API changes: the signature of
Childrenand the public constructor are the same; the rest is private or inside the internalRenderTreeBuilder.Benchmarks (BenchmarkDotNet, 6 alternating rounds, pinned to the performance cores):
Render(), real-world document (8,645 element nodes)Render(), selector-heavy document (112,865 element nodes)All differences are within the noise of single rounds (±5%); the allocations of a full
Render()are back at what they were before #267.🤖 Generated with Claude Code