ILSupport icon indicating copy to clipboard operation
ILSupport copied to clipboard

Very slow on big assembly

Open skarllot opened this issue 6 years ago • 3 comments

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.

skarllot avatar Dec 04 '19 19:12 skarllot

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/

ins0mniaque avatar Dec 19 '19 18:12 ins0mniaque

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?

abelbraaksma avatar Jun 01 '20 09:06 abelbraaksma

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

ins0mniaque avatar Jun 01 '20 16:06 ins0mniaque