KirillOsenkov / MSBuildStructuredLog

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

Fastest way to read Tasks + string properties #675

Closed jaredpar closed 1 year ago

jaredpar commented 1 year ago

I have a tool that is trying to read Task invocation data out of a binary log. The data I need is fairly straight forward:

  1. Identify type of task being invoked
  2. A few string properties on the task invocation

Today I'm accomplishing this via:

        var build = BinaryLog.ReadBuild(stream);
        BuildAnalyzer.AnalyzeBuild(build);

        build.VisitAllChildren(...)

The AnalyzeBuild takes a bit of time to complete, particularly for large logs. It does a lot of work I don't actually need. I was wondering if there is an API I'm potentially missnig where I can iterate through the tasks faster given I need, what I think, is minimal data off of them.

KirillOsenkov commented 1 year ago

Here you go: https://github.com/KirillOsenkov/MSBuildStructuredLog/wiki/Reading-binlog-files-programmatically#readrecords-sample

jaredpar commented 1 year ago

Thanks @KirillOsenkov. That got me moving in the right direction here. 😄