[plt-scheme] Typed, Contracts, and Normal Scheme Performance Comparison?

From: Robby Findler (robby at cs.uchicago.edu)
Date: Fri Nov 21 08:48:06 EST 2008

On Fri, Nov 21, 2008 at 7:39 AM, Matthias Felleisen
<matthias at ccs.neu.edu> wrote:
> On Nov 21, 2008, at 8:29 AM, Robby Findler wrote:
>> PLT's contract system encourages cheap contracts, mostly because
>> contracts live on module boundaries and tight loops tend not to be
>> across module boundaries.
>> While I have not done anything close to a careful study, I did
>> carefully measure the effect of dropping contracts from drscheme and
>> the impact was negligible.
> In this day and age, 'negligible' is a questionable statement :)

I don't think there is a day and age for which this should be
considered the be all and end all, but this was in a paper you are a
co-author on. Below is the relevant passage. That's truly all I know.

>From http://www.cs.uchicago.edu/~robby/pubs/papers/ecoop2004-fff.pdf:

"We have studied the performance impact of contracts in DrScheme. An instru-
mented version of DrScheme counts the number of functions and function
After starting up DrScheme and opening a few windows and Help Desk,
there are 27962
reachable functions and only 507 wrappers, i.e., slightly less than 2%
of the functions
are wrapped. With a different accounting annotation, DrScheme can also
determine the
number of function calls and calls to contract functions; for
basically the same start-up
action, the program performs 2,142,000 calls to user-defined
functions, of which 1425
are calls to contract wrappers. That is, 0.06% of the calls to
user-defined functions are
calls to wrappers. Unfortunately, it is difficult to generalize these
experiments, because
it is a major undertaking to write contracts for a large system of
components. Still, the
experiment with DrScheme suggests that well-chosen contracts have
little performance
impact on a large program. Based on our experience, the number of
contracts in a com-
ponent rarely exceeds 10% of the number of functions proper. Yet, even
if our system
were to contain that many wrapper functions, our experiments suggest
that only .3%
of the function calls would be calls to wrapper functions. "

Posted on the users mailing list.