[racket-dev] [plt] Push #20559: master branch updated

From: Robby Findler (robby at eecs.northwestern.edu)
Date: Thu Jun 24 10:13:32 EDT 2010

Were the contracts -> and/or ->*, or were they ->d?

Robby

On Wed, Jun 23, 2010 at 5:12 PM, Sam Tobin-Hochstadt <samth at ccs.neu.edu> wrote:
> On Wed, Jun 23, 2010 at 4:14 PM,  <eli at racket-lang.org> wrote:
>> 3f36d05 Eli Barzilay <eli at barzilay.org> 2010-06-23 16:10
>> :
>> | Turn contracts on `enqueue!' and `dequeue!' into the usual error checks.
>> |
>> | On a simple benchmark of:
>> |
>> |   (let ([N 100000]
>> |         [M 20]
>> |         [q (make-queue)])
>> |     (time (for ([i (in-range M)])
>> |             (for ([i (in-range (* i N))]) (enqueue! q i))
>> |             (unless (for/and ([i (in-range (* i N))]) (list i (dequeue! q)))
>> |               (error "poof")))))
>> |
>> | I get these timings:
>> |
>> |   original version: cpu time: 24438 real time: 24439 gc time: 8164
>> |   single-links:     cpu time: 17848 real time: 17849 gc time: 4859
>> |   this version:     cpu time:  6519 real time:  6519 gc time: 3032
>> |
>
> Do we really want to remove contracts from code just because they
> don't perform as well as hand-written checks?  Contracts offer a lot
> of advantages that hand-written checks don't have.  Also, did you try
> just changing the result contract from `void?' to `any/c'?
>
> --
> sam th
> samth at ccs.neu.edu
> _________________________________________________
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/dev
>


Posted on the dev mailing list.