I'm not sure about the uncollectable issue, but for the rest, try
running in racket, enabling the debug log. Eg, if you save the file in
x.rkt and do this:

  racket -W debug x.rkt

then you should see some messages telling you what is causing your
future to get stuck.

Also, do be sure to read this if you haven't yet:

  
http://docs.racket-lang.org/guide/performance.html#%28part._effective-futures%29

Robby

On Mon, Dec 20, 2010 at 12:47 PM, Eduardo Bellani <ebell...@gmail.com> wrote:
> Hello all
>
> I am trying to understand futures, and I have generated to following
> code to see how I would create reader futures. Unfortunately my futures
> are not running in parallel and are taking more time that the serial
> version. Besides that it seems to capture the vector in a way that it
> becomes noncollectable by the GC.
>
> Could anyone give some hints as to why? (my version is "5.0.2" on Linux)
>
> #lang racket
>
> (require racket/future rackunit rackunit/text-ui)
>
> (define DATA (make-vector 99999999 'datum))
>
> (define-test-suite read-from-shared
>  (test-suite "with futures"
>              (check-equal?
>               (time (let ([f (future (λ _ (read-data DATA)))])
>                       (touch f)
>                       (read-data DATA)))
>               (void)))
>
>  (test-suite "no futures"
>              (check-equal?
>               (time (read-data DATA)
>                     (read-data DATA))
>               (void))))
>
> (define (read-data some-data)
>  (for ([i (in-vector some-data)]) i))
>
> (run-tests read-from-shared)
>
>
> Thanks
>
> --
> Eduardo Bellani
>
> omnia mutantur, nihil interit.
> _________________________________________________
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users
_________________________________________________
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users

Reply via email to