Repository navigation
perf(markdown): flatten nested Element.textContent iteratively - #39
Conversation
PR HealthPublish ✔️
Documentation at https://github.com/dart-lang/ecosystem/wiki/Publishing-automation. This check can be disabled by tagging the PR with Changelog Entry ✔️
Changes to files need to be accounted for in their respective changelogs. This check can be disabled by tagging the PR with Breaking changes ✔️
This check can be disabled by tagging the PR with API leaks ✔️The following packages contain symbols visible in the public API, but not exported by the library. Export these symbols or remove them from your publicly visible API.
This check can be disabled by tagging the PR with Unused Dependencies ✔️
For details on how to fix these, see dependency_validator. This check can be disabled by tagging the PR with License Headers ✔️
All source files should start with a license header. Unrelated files missing license headers
This check can be disabled by tagging the PR with Coverage ✔️
This check for test coverage is informational (issues shown here will not fail the PR). This check can be disabled by tagging the PR with |
41869ce to
3be7fea
Compare
Summary
Element.textContentwith an explicit iterator stack and a singleStringBufferinstead of recursivechildren.map(...).join().Elementchildren are flattened in place; any otherNode(includingElementsubclasses) is asked for its owntextContent, so overridden getters keep working.StackOverflowError; nested text is no longer copied once per level.Impact
Output is unchanged (differential over spec inputs, pub-cache READMEs/CHANGELOGs, Hebrew samples and fuzz: byte-identical). Direct
textContentcalls are ~30% faster on parsed READMEs and ~7x on deep trees; end-to-endmarkdownToHtmlshows no measurable change, since only imagealttext reaches this path. Heading IDs are unaffected (they readUnparsedContent).Related
dart-lang#2737 (draft) plans the same change upstream.