can I get .net compiler to do some optimistic caching to speed up the build without refactoring code base into assemblies? -
my dotnet code base pretty big (so don't feel undertaking refactor assemblies project) doesn't change much. build real slow, although disk speed fine - apparently takes awhile compile thing. imho have made sense compiler cache compiled versions of files haven't changed since last build in optimistic expectation no change in file broke module. if optimistic assumption proved invalid, full build undertaken. well, pretty sure things done while using java , c++ compilers.
could done here in dotnet? if not, why not :-) ?
visual studio doesn't rebuild assembly unless has to. "has to" when of following change:
- assembly properties such target cpu/framework
- dependencies in referenced assemblies (if object a1 in assembly requires b1 in b, , b1 changes, assemblies , b must rebuilt)
- source code compile assembly (obviously)
also, build speed less dependent on pure code count, or class count, number of projects being built. given constant number of lines of code must rebuilt, solution builds 1 assembly build faster solution builds 10 assemblies, because there lot of overhead inherent in building assembly repeated on each assembly.
here basic tips increase build speed:
- try keep changes @ "high" level in assembly reference hierarchy possible. when dependent on b , b dependent on c, if changes, has rebuilt, if b or c change, higher must rebuilt. isn't possible, reducing number of assemblies reduce hierarchy when have rebuild lower one, there fewer other assemblies reliant on it.
- loosely couple code using interfaces cross-assembly dependency, , segregate interfaces own assembly. class dependent on class b have rebuilt if b changes. however, if instead dependent on interface b implements, won't have rebuilt if b changes; if (which far less common). however, vs builds assemblies; if in assembly b, assembly containing have rebuilt if b changes though didn't.
- create build configurations build absolutely necessary configuration. debug build should not rebuild installer. same token, release build should not rebuild testing assemblies. however, default, new projects set included in every build configuration, have maintain these configurations regularly.
- on installer front, see if can separate building configuration own. installers slowest single build of solution rebuild; first double-check assemblies built, collect need include , archive cab, encapsulated install logic in msi. avoid building unless producing release candidate.
- only "rebuild solution" when have to. rebuild solution performs "clean" plus "build", resulting in having recreated.
- minimize post-build actions. creating configs cut out unneeded assemblies, creating configs allow skip post-build actions when not needed, or rearranging solution build ends in right place begin with, speed considerably.
- tools resharper or svn clients, , indexing helpers go crazy when rebuild, reanalyzing new assemblies, determining changes, etc. make sure windows indexing service not index source code directories or build output locations, turn off resharper solution analysis, , don't include build output in svn versioning.
Comments
Post a Comment