I&#39;ve been hammering on the problem of speeding up scribble.  One of the things that&#39;s a surprise is that the contract checks on the part/element structure appear to be significant because Scribble documents are so granularly structured.<div>

<div><div><div><br></div><div><div>I focus on extract-part-style-files in scribble/base-render.rkt, which is called on the entire part structure to collect information on what style files are mentioned in the document.  On my system, when running Scribble on reference.scrbl, it took about 1.2 seconds for a single call to extract-part-style-files.  This made me blink: extract-part-style-files should just be a simple, linear walk through the tree structure to look for style file declarations (modulo dealing with delayed, traverse, and part-relative blocks, which look more complicated).</div>

<div><br></div><div>The contract checks appear to take a significant chunk of that time.  I&#39;ve judiciously added a few unsafe accessors, and the runtime of extract-part-style-files goes down from 1.2 seconds to 800 milliseconds.  That is, about 400 milliseconds, or 30% of the time of extract-part-style-files, is dedicated to contract checking alone.  My hack is up here:</div>

</div></div></div><div><br></div><div>    <a href="https://github.com/dyoo/racket/tree/scribble-speed">https://github.com/dyoo/racket/tree/scribble-speed</a></div><div><br></div><div>I haven&#39;t pushed these optimizations upstream yet because I&#39;d like a review to see if this is actually the right way to approach this particular problem.</div>

</div>