<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Linker throughput</title><link>http://blogs.msdn.com/b/vcblog/archive/2009/09/10/linker-throughput.aspx</link><description>Hello, my name is Chandler Shen, a developer from the Visual C++ Shanghai team. 
 We have made some changes in the upcoming Visual C++ 2010 release to improve the performance of linker. I would like to first give a brief overview of the linker and how</description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>re: Linker throughput</title><link>http://blogs.msdn.com/b/vcblog/archive/2009/09/10/linker-throughput.aspx#9919446</link><pubDate>Mon, 09 Nov 2009 09:29:47 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9919446</guid><dc:creator>patrick</dc:creator><description>&lt;p&gt;I agree with the cpp-&amp;gt;obj-&amp;gt;module comment.&lt;/p&gt;
&lt;p&gt;If I was in the compiler/linker business, I would start using RAM.&lt;/p&gt;
&lt;p&gt;The result is a service/daemon:&lt;/p&gt;
&lt;p&gt;- In-memory dependency graph(FindFirstChange etc.)&lt;/p&gt;
&lt;p&gt;- Traditional dependency check will not be necessary 99.99% of the time. It's done already.&lt;/p&gt;
&lt;p&gt;- Compiler pipes output directly to daemon&lt;/p&gt;
&lt;p&gt;- Daemon links in-memory&lt;/p&gt;
&lt;p&gt;- Daemon keeps result (dll/exe) in-memory&lt;/p&gt;
&lt;p&gt;- Daemon outputs dll/exe on-demand.&lt;/p&gt;
&lt;p&gt;Patrick&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9919446" width="1" height="1"&gt;</description></item><item><title>re: Linker throughput</title><link>http://blogs.msdn.com/b/vcblog/archive/2009/09/10/linker-throughput.aspx#9912129</link><pubDate>Fri, 23 Oct 2009 16:26:16 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9912129</guid><dc:creator>vcblog</dc:creator><description>&lt;p&gt;@Boris Sunik&lt;/p&gt;
&lt;p&gt;Thanks for your suggestion! We appreciate it so much!&lt;/p&gt;
&lt;p&gt;For the IncredBuild case, multiple PDB files will be generated, this will cost linker more time to merge them into one PDB.&lt;/p&gt;
&lt;p&gt;For your first suggestion, i think reading some of object segments in second step will utilize the power of multithreading, one thread is blocked by IO, another is blocked by CPU.&lt;/p&gt;
&lt;p&gt;Chandler &lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9912129" width="1" height="1"&gt;</description></item><item><title>re: Linker throughput</title><link>http://blogs.msdn.com/b/vcblog/archive/2009/09/10/linker-throughput.aspx#9911358</link><pubDate>Thu, 22 Oct 2009 13:47:06 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9911358</guid><dc:creator>Andre Vachon</dc:creator><description>&lt;p&gt;The VC++ team spends a lot of time investigating linker throughput issues. &amp;nbsp;The multi-threading work was done after demonstrating, through significant performance analysis of multiple scenarios, that it did actually increase overall performance&lt;/p&gt;
&lt;p&gt;Maybe your scenario exposes unique performance problem, but overall, I don't think we have obvious bad practices in the linker. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;Maybe I am wrong, and maybe there are. All I can say is we will continue to analyze linker performance, spending time understanding IO access patterns to further optimize throughput.&lt;/p&gt;
&lt;p&gt;We know linker throughput is one of the most important things to our customers, and we'll keep doing whatever we can to improve it.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9911358" width="1" height="1"&gt;</description></item><item><title>re: Linker throughput</title><link>http://blogs.msdn.com/b/vcblog/archive/2009/09/10/linker-throughput.aspx#9911265</link><pubDate>Thu, 22 Oct 2009 11:00:35 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9911265</guid><dc:creator>Boris Sunik</dc:creator><description>&lt;p&gt;One more remark.&lt;/p&gt;
&lt;p&gt;It seems that linker simultaneously writes debug info and reads input modules. &lt;/p&gt;
&lt;p&gt;Forming the complete debug info in memory and writing it at the program end will surely reduce the linking time. &lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9911265" width="1" height="1"&gt;</description></item><item><title>re: Linker throughput</title><link>http://blogs.msdn.com/b/vcblog/archive/2009/09/10/linker-throughput.aspx#9910633</link><pubDate>Wed, 21 Oct 2009 15:13:40 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9910633</guid><dc:creator>Boris Sunik</dc:creator><description>&lt;p&gt;I am working in the team developing huge C++ applications with circa 4000 source files and 2500 obj files. VS2008. Debug and Release configuration are built with debug info without /LTCG flag. Debug use incremental linking, Release don't use it.&lt;/p&gt;
&lt;p&gt;My machine is double core 2.3Gz 4096Mb&lt;/p&gt;
&lt;p&gt;Our concern are unsatisfactory linking times. Linking Debug configuration takes between 20 and 1200 sec. &lt;/p&gt;
&lt;p&gt;Linking Release lays between 270 and 1800 sec. &amp;nbsp;Besonders much time takes linking with IncredBuild also with high priority.&lt;/p&gt;
&lt;p&gt;I have two suggestions on the issue. &lt;/p&gt;
&lt;p&gt;First linker takes 25 minutes to link and after that its CPU link time is only 19 seconds and storage 350Mb. It would be nice if you will have a special option like /HUGEPROJECT and &amp;nbsp;read all object segments into the storage also on the first step. All modern computers have a lot of memory but it is simply doesn't used by your linker.&lt;/p&gt;
&lt;p&gt;Second, your linker obviously lacks satisfactory prelink check in the incremental modus to know whether it is possible to update the project in proper time. Every linker starting from 7.0 fails to link in acceptable time, if the changes in files are a little more than tiny. In result non-incremental linking takes 4 minutes, incremental 15. It is something other than a satisfactory performance.&lt;/p&gt;
&lt;p&gt;With Regards,&lt;/p&gt;
&lt;p&gt;Boris&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9910633" width="1" height="1"&gt;</description></item><item><title>re: Linker throughput</title><link>http://blogs.msdn.com/b/vcblog/archive/2009/09/10/linker-throughput.aspx#9907252</link><pubDate>Wed, 14 Oct 2009 17:36:10 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9907252</guid><dc:creator>vcblog</dc:creator><description>&lt;p&gt;@Alexandre Grigoriev&lt;/p&gt;
&lt;p&gt;1. Before writing to the final .PDB file, linker should check the debug information to assure no wrong data will be written. Unfortunately, the algorithm of this part is time-consuming.&lt;/p&gt;
&lt;p&gt;2 &amp;amp; 3. As for file I/O, the most time is cost by Page Fault handling (Reading a page from disk and writing a page into disk). Usually (with enough memory/CPU available), it has little difference whether user call WriteFile/ReadFile for N times, each process one record, or call WriteFile/ReadFile just once which process N records.&lt;/p&gt;
&lt;p&gt;4. As for ICF, linker will compare two COMDATs byte-by-byte before folding one of them, before that, linker will check some flags or characteristics to avoid such comparing. So if there many functions within one module (.obj file) which having same size of code and similar implementation, linker will be slowed down.&lt;/p&gt;
&lt;p&gt;Chandler&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9907252" width="1" height="1"&gt;</description></item><item><title>re: Linker throughput</title><link>http://blogs.msdn.com/b/vcblog/archive/2009/09/10/linker-throughput.aspx#9906228</link><pubDate>Mon, 12 Oct 2009 18:13:57 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9906228</guid><dc:creator>Alexandre Grigoriev</dc:creator><description>&lt;p&gt;Also, how ICF (indentical COMDAT folding) affects the link time? Default BUILD script enables it by default, even in checked builds (which I believe is bad for setting breakpoints during debugging).&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9906228" width="1" height="1"&gt;</description></item><item><title>re: Linker throughput</title><link>http://blogs.msdn.com/b/vcblog/archive/2009/09/10/linker-throughput.aspx#9906224</link><pubDate>Mon, 12 Oct 2009 18:02:24 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9906224</guid><dc:creator>Alexandre Grigoriev</dc:creator><description>&lt;p&gt;A few observations:&lt;/p&gt;
&lt;p&gt;1. PDB vs no-PDB difference tells that the binary write is much faster than PDB write. Why? I suppose you just have to dump the tables already built in memory. Parallelising them would save a pittance. A reason for longer PDB write could be that the current linker creates the PDB file as compressed. If you issue writes in pieces smaller than the compression unit (64K or so?) it could cause multiple compress-decompress rounds. I hope the linker is not calling WriteFile per each PDB record; that would just kill the performance.&lt;/p&gt;
&lt;p&gt;2 Typically, it makes sense to avoid writing two large files in parallel in small pieces. The most effective approach is to build the data in memory and write it in one shot. With the modern memory sizes, it's feasible. And NO, a file mapping doesn't beat that; forget it. Especially a mapped compressed file (PDB).&lt;/p&gt;
&lt;p&gt;3. If you deal with a lot of small files, it makes sense to read them to memory, as many as possible. To avoid disk thrashing, open a bunch of them at once, and then read; don't do one by one.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9906224" width="1" height="1"&gt;</description></item><item><title>re: Linker throughput</title><link>http://blogs.msdn.com/b/vcblog/archive/2009/09/10/linker-throughput.aspx#9899753</link><pubDate>Sat, 26 Sep 2009 02:34:17 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9899753</guid><dc:creator>David Nelson</dc:creator><description>&lt;p&gt;@CMWoods,&lt;/p&gt;
&lt;p&gt;It is standard practice in most professional development shops to store PDBs for all released binaries, even if the PDBs themselves are not released, for help in debugging. Adding /debug to the default template was an effect, not a cause.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9899753" width="1" height="1"&gt;</description></item><item><title>re: Linker throughput</title><link>http://blogs.msdn.com/b/vcblog/archive/2009/09/10/linker-throughput.aspx#9899516</link><pubDate>Fri, 25 Sep 2009 17:34:49 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9899516</guid><dc:creator>CMWoods</dc:creator><description>&lt;p&gt;&amp;quot;Most users normally specify /debug when linking, irrespective of whether the application is built under “debug” or “release” configuration.&amp;quot;&lt;/p&gt;
&lt;p&gt;Are you sure that's actually intensional or is it more likely that &amp;quot;most users&amp;quot; just didn't notice that MS added /debug to the default project templates a few versions ago?&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9899516" width="1" height="1"&gt;</description></item></channel></rss>