AArnott / CodeGeneration.Roslyn

Assists in performing Roslyn-based code generation during a build.
Microsoft Public License
408 stars 59 forks source link

Run code generation in parallel #226

Open dominikjeske opened 4 years ago

dominikjeske commented 4 years ago

Current implementation of Codegen is using simple loop for code generation. Maybe it would be better to use Parallel.For or other multithread mechanism?

amis92 commented 4 years ago

@bigdnf Hi.

Parallelism introduces a lot of issues we'd need to resolve. First we'd need to get some hard numbers. How long does it take for generators to run, in comparison with the whole run time of the Tool? Are these costs comparable?

If we can definitely prove that code generation takes most of the time, and not the warm-up and actual compilation before generators are invoked, we can proceed with implementation.

For exactly that purpose, I'll open a new issue to add performance tracking somehow into the Tool. Total run time of the Tool is registered by MSBuild anyway. So then we'll be able to compare these values.