microsoft / clrmd

Microsoft.Diagnostics.Runtime is a set of APIs for introspecting processes and dumps.
MIT License
1.06k stars 256 forks source link

Add deferred loading of module information for ClrModules #1254

Closed PhDuck closed 6 months ago

PhDuck commented 6 months ago

For processes with numerous loaded modules, the overhead of fetching module information becomes prohibitively expensive.

Introduce that population of module information is deferred until accessed. A few minor changes was done to avoid triggering the load of module info.

Time measurements, of getting stack traces of a process with 200K modules loaded, showed a reduction of 9/10 of execution time.

leculver commented 6 months ago

Sorry for the delay, I have had other work going on. I will take a look at this PR this week.

leculver commented 6 months ago

After some thought, let's just go with Lazy here. The amount of modules for most sane processes should be fairly reasonable, so I'm not worried about the extra allocations.