Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance issue with GetCustomDebugInformation #684

Closed
marek-safar opened this issue Aug 5, 2020 · 1 comment · Fixed by #771
Closed

Performance issue with GetCustomDebugInformation #684

marek-safar opened this issue Aug 5, 2020 · 1 comment · Fixed by #771

Comments

@marek-safar
Copy link
Contributor

When linking a set of assemblies which contain Microsoft.SourceLink.GitHub with EmbedUntrackedSources enabled, the processing time will increase significantly.

Lots of the processing time is spent in GetCustomDebugInformation :

using (var deflate_stream = new DeflateStream (compressed_stream, CompressionMode.Decompress, leaveOpen: true))

Here's a stack trace leading to this:

 	mscorlib.dll!System.IO.Stream.InternalCopyTo(System.IO.Stream destination, int bufferSize)	Unknown
>	Mono.Cecil.dll!Mono.Cecil.MetadataReader.GetCustomDebugInformation(Mono.Cecil.Cil.ICustomDebugInformationProvider provider) Line 3242	C#
 	Mono.Cecil.dll!Mono.Cecil.MetadataReader.GetDocument(uint rid) Line 2881	C#
 	Mono.Cecil.dll!Mono.Cecil.MetadataReader.ReadSequencePoints(Mono.Cecil.MethodDefinition method) Line 2870	C#
 	Mono.Cecil.dll!Mono.Cecil.Cil.PortablePdbReader.Read(Mono.Cecil.MethodDefinition method) Line 118	C#
 	Mono.Cecil.dll!Mono.Cecil.Cil.CodeReader.ReadMethodBody() Line 109	C#
 	Mono.Cecil.dll!Mono.Cecil.Cil.CodeReader.ReadMethodBody(Mono.Cecil.MethodDefinition method) Line 61	C#
 	Mono.Cecil.dll!Mono.Cecil.MethodDefinition.get_Body.AnonymousMethod__41_0(Mono.Cecil.MethodDefinition method, Mono.Cecil.MetadataReader reader) Line 154	C#
 	Mono.Cecil.dll!Mono.Cecil.ModuleDefinition.Read<System.__Canon, System.__Canon>(ref System.__Canon variable, System.__Canon item, System.Func<System.__Canon, Mono.Cecil.MetadataReader, System.__Canon> read) Line 989	C#
 	Mono.Cecil.dll!Mono.Cecil.MethodDefinition.Body.get() Line 156	C#
 	monolinker.exe!Mono.Linker.Steps.RemoveUnreachableBlocksStep.RewriteBody(Mono.Cecil.MethodDefinition method) Line 129	C#
 	monolinker.exe!Mono.Linker.Steps.RemoveUnreachableBlocksStep.RewriteBodies(Mono.Collections.Generic.Collection<Mono.Cecil.TypeDefinition> types) Line 119	C#
 	monolinker.exe!Mono.Linker.Steps.RemoveUnreachableBlocksStep.Process() Line 45	C#
 	monolinker.exe!Mono.Linker.Steps.BaseStep.Process(Mono.Linker.LinkContext context) Line 60	C#
 	monolinker.exe!Mono.Linker.Pipeline.ProcessStep(Mono.Linker.LinkContext context, Mono.Linker.Steps.IStep step) Line 134	C#
 	monolinker.exe!Mono.Linker.Pipeline.Process(Mono.Linker.LinkContext context) Line 127	C#
 	monolinker.exe!Mono.Linker.Driver.Run(Mono.Linker.ILogger customLogger) Line 609	C#
 	monolinker.exe!Mono.Linker.Driver.Execute(string[] args, Mono.Linker.ILogger customLogger) Line 67	C#
 	monolinker.exe!Mono.Linker.Driver.Main(string[] args) Line 51	C#

Originally reported as dotnet/linker#1409

@jbevain
Copy link
Owner

jbevain commented Aug 5, 2020

I see. Yeah that makes sense. We probably shouldn't even decompress/compress unless the user asked to access the uncompressed content, that should speed things up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants