Skip to content

Optimize HtmlNode.WriteAttribute#556

Merged
JonathanMagnan merged 1 commit intozzzprojects:masterfrom
lahma:write-stream-without-concatenation
Sep 15, 2025
Merged

Optimize HtmlNode.WriteAttribute#556
JonathanMagnan merged 1 commit intozzzprojects:masterfrom
lahma:write-stream-without-concatenation

Conversation

@lahma
Copy link
Contributor

@lahma lahma commented Jun 29, 2024

When checking for docfx performance, I noticed that a lot of string allocations were done inside of HtmlAgilityPack. This PR changes WriteAttribute to call separate Write calls instead of concatenating strings before writing them.

image

@lahma lahma force-pushed the write-stream-without-concatenation branch from aa058eb to c4dee93 Compare October 13, 2024 10:23
@alex-jitbit
Copy link

I literally came here to write a PR that does this!!!

After tracing my app and finding that WriteAttribute causes tons of memory allocations in my app.

@JonathanMagnan JonathanMagnan merged commit fc7fa73 into zzzprojects:master Sep 15, 2025
@lahma lahma deleted the write-stream-without-concatenation branch September 16, 2025 03:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants