Very slow on big assembly
When I try to include IL code on a project that when decompiled generates a 7 MB IL file, the regex-based replacements take minutes to run.
The CPU usage is low and memory usage grows while running.
Not much I can do, I'm not sure how I could improve the regex or inject IL otherwise. You could move some code to a separate assembly to speed things up.
However, there is also another way to compile IL. Microsoft now provides Microsoft.NET.Sdk.IL to create .ilproj projects. You can see its usage in System.Runtime.CompilerServices.Unsafe.
This blog post also describes how to create IL projects: https://www.strathweb.com/2019/12/creating-common-intermediate-language-projects-with-net-sdk/
I was thinking of having a look at those regexes, since it sounds like a typical (.*)*-like problem, but browsing through the code couldn't see (in
this repo) which ones @skarllot you're talking about. Could you point me to the place where these regexes are used?
The regexes are inside each project. This is the part of the template containing the regexes used to generate the project templates: https://github.com/ins0mniaque/ILSupport/blob/5f23be0d345a386ba4a041a63a127a7f443a0f9a/IL%20Support.ProjectTemplates/IL%20Support.targets#L49-L56