7

I have two .NET libraries: "Foo.Bar" and "Foo.Baz".
"Foo.Bar" is self-contained, while "Foo.Baz" references "Foo.Bar".

Assuming I do the following:

  • Use ILMerge to merge "Foo.Bar.dll" with "Foo.Baz.dll" into "Foo1.dll".
  • Create a new solution containing the entirity of both "Foo.Bar" and "Foo.Baz" (since I have access to their source code), and compile this into "Foo2.dll".

Will there be any differences in the performance of Foo1.dll and Foo2.dll when using their functionality from an external project? If so, how significant is this performance difference, and is it a once-off (on load?) or ongoing difference? Are there any other advantages or disadvantages with either approach?

Matthew King
  • 5,114
  • 4
  • 36
  • 50

1 Answers1

3

I'm sure it wouldn't produce exactly the same IL, but it would be extremely close and I can't imagine any appreciable difference between the two methods. Other than the fact that the ILMerge method is probably more convenient and maintainable, I think both solutions would have the same outcome.

Josh
  • 68,005
  • 14
  • 144
  • 156
  • Why wouldn't it produce the exact same IL? Why would ILMerge have to emit new IL? – Matthew Olenik Apr 22 '10 at 06:16
  • The bulk of the IL will be the same, but ILMerge does make some transformations. Some of it is configurable like merging type definitions. Some of it has to do with assembly-level attributes. I think it can change type visibility, etc. – Josh Apr 22 '10 at 06:25
  • None of which should affect the performance of the assembly, mind you. – Josh Apr 22 '10 at 06:26