Were the contracts -> and/or ->*, or were they ->d? Robby
On Wed, Jun 23, 2010 at 5:12 PM, Sam Tobin-Hochstadt <sa...@ccs.neu.edu> wrote: > On Wed, Jun 23, 2010 at 4:14 PM, <e...@racket-lang.org> wrote: >> 3f36d05 Eli Barzilay <e...@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 > sa...@ccs.neu.edu > _________________________________________________ > For list-related administrative tasks: > http://lists.racket-lang.org/listinfo/dev > _________________________________________________ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/dev