Sandcastle performance

May 14, 2009 at 4:06 PM

I tried to use Sandcastle (with help of DocProject) on my project.

It takes me 6 hours. Here's some statictics:

-----------------------[ begin ]---------------------------
Step 1 of 21: Change Directory
Step 1 Time Elapsed: 00:00:00.0060000

Step 2 of 21: Execute MRefBuilder
Info: Wrote information on 263 namespaces, 3596 types, and 21126 members
Step 2 Time Elapsed: 00:00:24.6910000

Step 3 of 21: Execute XslTransform
Step 3 Time Elapsed: 00:05:02.4590000

Step 4 of 21: Copy File
Step 4 Time Elapsed: 00:00:07.9290000

Step 5 of 21: Execute XslTransform
XslTransform (v2.4.10520.1)
Info: Applying XSL transformation 'C:\Program Files (x86)\Sandcastle\ProductionTransforms\ReflectionToManifest.xsl'.
Step 5 Time Elapsed: 00:00:37.4430000

Step 6 of 21: Execute XslTransform
XslTransform (v2.4.10520.1)
Info: Applying XSL transformation 'C:\Program Files (x86)\Sandcastle\ProductionTransforms\CreateVSToc.xsl'.
Step 6 Time Elapsed: 00:00:45.2580000

Step 7 of 21: Build Assembler {sandcastle.help1x.config}
Topics processed: 38204
Step 7 Time Elapsed: 00:38:06.7290000

Step 8 of 21: Copy Directory
Step 8 Time Elapsed: 00:00:01.4480000

Step 9 of 21: Change Directory
Step 9 Time Elapsed: 00:00:00.0380000

Step 10 of 21: Execute ChmBuilder
Processed 38200 files.
Step 10 Time Elapsed: 00:17:51.5250000

Step 11 of 21: Execute DBCSFix
Step 11 Time Elapsed: 00:00:02.8080000

Step 12 of 21: Compile Help 1.x
Compile time: 12 minutes, 24 seconds
38,200    Topics
474,568    Local links
0    Internet links
0    Graphics
Created c:\myfile\xxx.chm, 54,384,144 bytes
Compression decreased file by 435,299,207 bytes.
Step 12 Time Elapsed: 00:12:31.0950000

Step 13 of 21: Prepare Working Directory
Step 13 Time Elapsed: 00:01:54.6570000

Step 14 of 21: Execute XslTransform
Step 14 Time Elapsed: 00:00:29.3000000

Step 15 of 21: Import missing Help 2.x files
Step 15 Time Elapsed: 00:00:00.4770000

Step 16 of 21: Execute XslTransform
XslTransform (v2.4.10520.1)
Info: Applying XSL transformation 'C:\Program Files (x86)\Sandcastle\ProductionTransforms\TocToHxSContents.xsl'.
Step 16 Time Elapsed: 00:00:03.5060000

Step 17 of 21: Build Assembler {sandcastle.help2x.config}
Topics processed: 38204
Step 17 Time Elapsed: 04:00:34.9940000

Step 18 of 21: Copy Directory
Step 18 Time Elapsed: 00:15:36.3390000

Step 19 of 21: Copy Directory
Step 19 Time Elapsed: 00:00:00.1380000

Step 20 of 21: Updating Help 2.x TOC
Step 20 Time Elapsed: 00:00:02.4660000

Step 21 of 21: Compile Help 2.x
Step 21 Time Elapsed: 00:26:16.8300000

Total Time Elapsed: 06:00:34.5310000
-----------------------[ end ]---------------------------

I known Sandcastle has very extensible design like pipeline, it's great. But 6 hours! It's too much.

It would be very nice to see some kind of optimization in near future.

What does it do on "Build Assembler" stage?

May 14, 2009 at 6:54 PM

Hi,

As you've pointed out, the time of the second run of Build Assembler (which rebuilds the topics specifically for Help 2.x output using the Index MSDN link type) is quite a big difference from the first.  Seems like something is going wrong in the second pass - perhaps an issue with memory usage.

First you could try buildling on the command-line using MSBuild: http://docproject.codeplex.com/Wiki/View.aspx?title=How%20To%20Build%20Compiled%20Help%20With%20MSBuild

Note that you can also gain some performance by setting Build | Build assembler options to Trace Errors, Cancelable only, in the DocProject Properties window.  If the issue with the second pass slowing down is related to available memory then this may also work around it.

Also, if you're not going to be using the MS Help (.HxS) output type then simply exclude it (set Build | Help 2.x to Disabled).  Then the build will end around step 12.

Alternatively, if don't need the Help 1.x (.chm) output, then simply exclude it (set Build | Help 1.x to Disabled).  You may want to try excluding Help 1.x output anyway just to see if it has any affect on the build time for .HxS output.

There's also the possibility to combine the two Build Assembler configuration files (one for each output type) into a single configuration file to improve performance even more and possibly work around whatever issue is causing the slow-down for the second pass; however, DocProject is not yet designed to take advantage of this possibility so you may have to play around with some things.  See the following discussion for more information if you're interested:

Tips: Introducing CloneComponent
http://sandcastle.codeplex.com/Thread/View.aspx?ThreadId=33002

- Dave