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

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

On Fri, Nov 21, 2008 at 7:47 AM, Paulo J. Matos <pocmatos at gmail.com> wrote:
> On Fri, Nov 21, 2008 at 1:29 PM, Robby Findler <robby at cs.uchicago.edu> 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.
>>
>
> Thanks for the reply. What does your intuition say about the
> performance of using typed-scheme instead of contracts? Would the
> difference also be negligible?

There is the obvious 'remove the checks' optimization that can be
done, but is not yet being done. After that, there are a few large
research programs aimed at pushing type information all the way thru
the compiler and they have shown that you can do better if you do
that, but I'm not enough of an expert to know if it is worth the
energy required (my guess: no).

> Regarding this question, I would even hope that by using typed scheme,
> the compiler could use this annotations to improve compiled code, but
> as far as i know this as not been done yet, right? On the other hand,
> then, typed-scheme shouldn't have any performance degradation when
> comparing to normal scheme as it is not a runtime feature, like
> contracts, or am I wrong?

Typed scheme does use contracts for interop, so it isn't completely clear.

Also, typed scheme does (cough) type checking and that takes time. For
some programs, compilation is a significant part of the running time.

So, I guess the answer is "it depends" :)

Robby


Posted on the users mailing list.