Removing unused source files
#1
Posted 15 October 2009 - 01:53 PM
I'm planning on adding a large library to one of my project, but will only use a fraction of its functionality. In order to keep build times low I'd like to keep just the source files that are actually required for the functionality I use. Using a separately built library is not an option because the libary is updated regularly and I'm making some small changes to its source code.
So does anyone know of any tool to detect which files can be safely removed from the build? I'm using Visual C++. Note that a full rebuild takes tens of minutes and there are hundreds of files so removing files one by one is not an option. :surrender
Thanks!
Nick
#2
Posted 15 October 2009 - 05:30 PM
#3
Posted 15 October 2009 - 05:48 PM
1. Fastest drive setup (striped RAID on fast drives)
2. Fastest CPU
3. Parallel and/or distributed builds, like w/MPCL (parallel) or Incredibuild (basically a parallel and distributed Make), but it requires multiple systems that can be used for builds.
EDIT: A buddy of mine also pointed me to Unity Building.
#4
Posted 15 October 2009 - 05:57 PM
Put third party libraries in separate solution.
Configure every project in that solution to put output LIB files to a single specific folder, like "linklib" in my example.
Build it once for release and for debug.
Link your main project with libs from this folder.
--
Don't bother with removing "unused" files. That will be much harder than you might think.
#5
Posted 15 October 2009 - 06:33 PM
alphadog said:
#6
Posted 15 October 2009 - 06:39 PM
alphadog said:
Quote
Quote
Anyway, while this is valid advice it's really no cure. I already have a really fast system so there's little left to improve. Really the issue I'm having is that it's a gigantic project and I'm only using a small portion of it (but it's fairly tightly interwoven).
#7
Posted 15 October 2009 - 06:51 PM
#8
Posted 15 October 2009 - 07:17 PM
BTW, SSD may not help, esp. now and until the SSDs mature, since they write slow, esp. with lots of random, small file writes.
Parallelizing or distributing your builds can have a dramatic effect on time. But, you can only gain that by adding a layer to your build.
Another thought: RAM drive. Use something like SuperVolume to mitigate the effect of reboots or crashes on data loss.
#9
Posted 15 October 2009 - 07:35 PM
Write a script that:
a) moves a possible target file to a temp folder
c) check if it errors, move it back
Loop ad nauseum overnight and don't look back. :sneaky:
#10
Posted 15 October 2009 - 07:52 PM
#11
Posted 15 October 2009 - 09:49 PM
kvakvs said:
Configure every project in that solution to put output LIB files to a single specific folder, like "linklib" in my example.
Build it once for release and for debug.
Link your main project with libs from this folder.
Quote
Anyway, I found a strategy that is workable. The compiler doesn't detect when I remove files (so I need a full rebuild to check whether it was needed or not), but it does detect when I empty the content. This way it only recompiles the (empty) file and relinks, which is a lot faster. It's still a tedious job for over a hundred files but it looks like it will only take a couple hours which is well worth it...
#12
Posted 15 October 2009 - 10:06 PM
alphadog said:
Quote
Quote
Quote
#13
Posted 16 October 2009 - 01:17 AM
#14
Posted 16 October 2009 - 04:09 PM
#15
Posted 16 October 2009 - 04:10 PM
kvakvs said:
Do you know of any issues with it? A few sites report that it doesn't work properly when multiple files try to update .pdb files. But maybe that has been fixed with recent service packs?
#16
Posted 16 October 2009 - 05:34 PM
Nick said:
Do you know of any issues with it? A few sites report that it doesn't work properly when multiple files try to update .pdb files. But maybe that has been fixed with recent service packs?
Did not notice any problems in my two solutions (one with third party libs about 10-12 libraries and another with 5 projects main executable). Well, except usual visual studio screw-ups with Intellisense, and random insignifficant trouble which seemingly were not related to having /MP enabled.
Also you can disable it for release builds, hope you don't do them 10 times everyday.
#17
Posted 16 October 2009 - 10:20 PM
#18
Posted 29 January 2010 - 05:12 AM
For each include and source file, comment out each include file one at a time and see if it compiles.
It is also a good idea to sort the include files alphabetically, and where this is not possible.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users












