[racket-dev] member like assoc

From: Asumu Takikawa (asumu at ccs.neu.edu)
Date: Sun Jun 9 21:58:29 EDT 2013

On 2013-06-09 20:51:21 -0500, Robby Findler wrote:
>    Do the times change if you put an 'in-range' in the for loops?

Is this the code change you meant?

  #lang racket/base
  (require (only-in racket/list range))
  (define lst (range 1 5000))
  (time
    (for ([i (in-range 30000)])
      (member 2500 lst)))

  ;;; NEW BRANCH
  $ racket member-benchmark-3.rkt
  cpu time: 1756 real time: 1760 gc time: 0
  $ racket --no-jit member-benchmark-3.rkt
  cpu time: 1524 real time: 1530 gc time: 0

  ;;; MASTER
  $ racket member-benchmark-3.rkt
  cpu time: 1756 real time: 1761 gc time: 0
  $ racket --no-jit member-benchmark-3.rkt
  cpu time: 1532 real time: 1535 gc time: 0

Cheers,
Asumu

Posted on the dev mailing list.