<p dir="ltr">For more detailed measurements of the cost of scribble contract checking, our recent OOPSLA paper on chaperones includes a benchmark which renders the reference both with and without contracts.</p>
<p dir="ltr">Sam</p>
<div class="gmail_quote">On Nov 9, 2012 9:03 PM, "Robby Findler" <<a href="mailto:robby@eecs.northwestern.edu">robby@eecs.northwestern.edu</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I think the contracts on struct accessors (and specifically in<br>
scribble core data structures) is significant. If you have ideas on<br>
how to speed them up, that'd be welcome. I think they are set up to be<br>
easily disabled (they are added with a macro somewhere) so you can<br>
time things if you want.<br>
<br>
FWIW, those contracts have been helpful to me on numerous occasions so<br>
I would object to simply removing them. But it seems like there could<br>
be some clever thinking that would help us pay the price when running<br>
scribble docs.<br>
<br>
On Fri, Nov 9, 2012 at 7:17 PM, Danny Yoo <<a href="mailto:dyoo@hashcollision.org">dyoo@hashcollision.org</a>> wrote:<br>
> I've been hammering on the problem of speeding up scribble. One of the<br>
> things that's a surprise is that the contract checks on the part/element<br>
> structure appear to be significant because Scribble documents are so<br>
> granularly structured.<br>
><br>
> I focus on extract-part-style-files in scribble/base-render.rkt, which is<br>
> called on the entire part structure to collect information on what style<br>
> files are mentioned in the document. On my system, when running Scribble on<br>
> reference.scrbl, it took about 1.2 seconds for a single call to<br>
> extract-part-style-files. This made me blink: extract-part-style-files<br>
> should just be a simple, linear walk through the tree structure to look for<br>
> style file declarations (modulo dealing with delayed, traverse, and<br>
> part-relative blocks, which look more complicated).<br>
><br>
> The contract checks appear to take a significant chunk of that time. I've<br>
> judiciously added a few unsafe accessors, and the runtime of<br>
> extract-part-style-files goes down from 1.2 seconds to 800 milliseconds.<br>
> That is, about 400 milliseconds, or 30% of the time of<br>
> extract-part-style-files, is dedicated to contract checking alone. My hack<br>
> is up here:<br>
><br>
> <a href="https://github.com/dyoo/racket/tree/scribble-speed" target="_blank">https://github.com/dyoo/racket/tree/scribble-speed</a><br>
><br>
> I haven't pushed these optimizations upstream yet because I'd like a review<br>
> to see if this is actually the right way to approach this particular<br>
> problem.<br>
><br>
> _________________________<br>
> Racket Developers list:<br>
> <a href="http://lists.racket-lang.org/dev" target="_blank">http://lists.racket-lang.org/dev</a><br>
><br>
_________________________<br>
Racket Developers list:<br>
<a href="http://lists.racket-lang.org/dev" target="_blank">http://lists.racket-lang.org/dev</a><br>
</blockquote></div>