KirillOsenkov / MSBuildStructuredLog

A logger for MSBuild that records a structured representation of executed targets, tasks, property and item values.
MIT License
1.47k stars 198 forks source link

Remove some low-hanging fruit allocation #821

Closed stephentoub closed 2 months ago

stephentoub commented 2 months ago

@KirillOsenkov asked me to look at why the .NET 8 build was slower than the .NET Framework build (answer: https://github.com/KirillOsenkov/MSBuildStructuredLog/pull/819), and why so much time was being taken up in ReadByte (answer: https://github.com/KirillOsenkov/MSBuildStructuredLog/issues/820, https://github.com/dotutils/streamutils/pull/2). But while looking into it, I did an allocation profile and noticed some low-hanging fruit easily avoided, so this addresses those.

KirillOsenkov commented 2 months ago

Original: image

This PR: image

Allocations are down from 86.8 GB -> 84.4 GB! Very nice!

The time probably needs to be measured several times to be accurate.