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

From: Sam TH (samth at ccs.neu.edu)
Date: Fri Nov 21 08:52:02 EST 2008

On Fri, Nov 21, 2008 at 8: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?
>
> 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?

At the border between typed and untyped code, contracts are
automatically synthesized, so if you have one module that uses types,
it will have performance comparable to using contracts.  If you
convert multiple modules, there's no overhead for communication
between them, and thus the performance is potentially better than
contracts.  However, as Robby said, depending on your code
organization, all of this overhead may well be small.

Thanks,
-- 
sam th
samth at ccs.neu.edu


Posted on the users mailing list.