Skip to content

BinLog Perf

Kirill Osenkov edited this page Sep 17, 2024 · 32 revisions

See related:

Make BinaryLogger into a distributed/forwarding/node logger: https://github.com/KirillOsenkov/MSBuildStructuredLog/issues/231

Stephen Toub's perf improvements

Streams weren't overriding all default methods, resulting in bad defaults:

Turn on Server GC for .NET 8:

Remove some low-hanging fruits for allocations:

  Total opening time Loading Analyzing Indexing Reading files Allocated (GB)
original net472 2:34 1:06 0:33 0:25 0:24 84.7
latest net472 2:06 0:50 0:21 0:26 0:22 65
latest net8.0 1:42 0:29 0:23 0:17 0:27 59

Perf and memory

Investigate not logging the Message for certain EventArgs types (since it is redundant and will be reconstructed when reading anyway) Don't materialize LazyFormattedBuildEventArgs.Message in packet serializer and binary logger https://github.com/dotnet/msbuild/issues/6199

Do not log task inputs/outputs when LogTaskInputs is set (RAR) https://github.com/dotnet/msbuild/issues/6305

Consider deleting BuildEventArgs.ThreadId https://github.com/dotnet/msbuild/issues/6152

Investigate getting rid of locker object on LazyFormattedBuildEventArgs https://github.com/dotnet/msbuild/issues/6002

Scalar task parameters

Output files & Input files for skipped targets

MSBuildAllProjects concatenated take up too much space

DefaultItemExcludes reassignment takes up too much space

Encountered conflict between message from ResolvePackageFileConflicts task

Log less

Investigate reducing logging for ProjectStarted: https://github.com/microsoft/msbuild/issues/5316 https://github.com/microsoft/msbuild/issues/3616

Set MSBUILDTRUNCATETASKINPUTS environment variable to 1 to truncate task inputs: https://github.com/microsoft/msbuild/pull/5210/files#diff-5f4088c7b8512fa52f7faf88f89661f3R122

Control logging

Need to be able to control LogTaskInputs independently of Verbosity or /bl https://github.com/microsoft/msbuild/issues/5233

Binary logger should respect verbosity https://github.com/microsoft/msbuild/issues/4543

Binlog causes detailed summary messages output to console https://github.com/microsoft/msbuild/issues/4409

==========

Roslyn build (no binlog): 10:07.453
Roslyn build (-binaryLog): 10:01.515
Roslyn build (-binaryLog, with https://github.com/microsoft/msbuild/pull/5268): 09:44.085

==========

old:
1:38
1:29
1:29
1:24

old no binlog:
1:00

new:
1:25
1:30
1:20
1:21

new no binlog:
1:07
1:03

==========