[racket-dev] More Scribble optimization; contracts?

From: Danny Yoo (dyoo at hashcollision.org)
Date: Fri Nov 9 20:17:20 EST 2012

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

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).

The contract checks appear to take a significant chunk of that time.  I'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:

    https://github.com/dyoo/racket/tree/scribble-speed

I haven't pushed these optimizations upstream yet because I'd like a review
to see if this is actually the right way to approach this particular
problem.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/dev/archive/attachments/20121109/06e396f0/attachment.html>

Posted on the dev mailing list.