Optimization Question

C

cmay

I was reading the article "Performance Optimization in Visual Basic
..NET" at
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vstechart/html/vbtchperfopt.asp.

One section states:
Loading a dynamic-link library (DLL) takes a considerable amount of
execution time. Bringing in a DLL only to call one or two procedures is
highly inefficient. You should try to generate the smallest possible
number of DLLs, even if this makes them relatively large. This means
your application should use as few projects as possible and large
solutions.


When I need to reference some code in multiple projects (e.g. a data
access class), I have been building it into a DLL and referencing the
DLL in my other projects. Does this mean that I should instead add a
reference to the data access layer PROJECT in my solution, rather than
a reference to the DLL that it produces?

When you have multiple projects in a solution, and references between
them, doesn't the compiler build them all into their own DLL anyway?
I guess I'm not sure what they mean and am looking for help. Thanks.
 
H

Herfried K. Wagner [MVP]

cmay said:
When I need to reference some code in multiple projects (e.g. a data
access class), I have been building it into a DLL and referencing the
DLL in my other projects. Does this mean that I should instead add a
reference to the data access layer PROJECT in my solution, rather than
a reference to the DLL that it produces?

Technically there is no difference between referencing the DLL and
referencing the project of the DLL. Referencing the project will give you a
better debugging experience.
When you have multiple projects in a solution, and references between
them, doesn't the compiler build them all into their own DLL anyway?

Each project will be built into a separate DLL.
 
L

Larry Serflaten

cmay said:
When you have multiple projects in a solution, and references between
them, doesn't the compiler build them all into their own DLL anyway?
I guess I'm not sure what they mean and am looking for help. Thanks.

You are correct. What we need is a way to ask the compiler to reach out
to a 'common' DLL and grab the IL code for inclusion into the current
project. I have made such a suggestion to the development team, but as
yet it is just talk.

Not only would it help you in your current situation, but it also would
help those who want to share 'packaged' code (think specialized Math
class) such that they can hand over the DLL and let the user use just
what they need for inclusion in their project. Even if there are over
100 routines in the DLL, the user may only need 10-15 of them, and
should have a way to 'statically link' to that DLL so that the desired code
is added to his project, without the need of shipping that much larger DLL.

LFS
 
C

cmay

Any idea why MS suggests that this would provide better performance
when it really doesn't?

Any word of if they are planning the kind of implementation you are
talking about?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top