On Sun, 13 Aug 2017 15:59:17 -0700 (PDT), Zelphir Kaltstahl
<zelphirkaltst...@gmail.com> wrote:

>I tested using futures. While it is significantly faster than creating places, 
>it is still also significantly slower than the single threaded solution 
>without places and without futures:
>(define (gini-index-futures subsets label-column-index)
>  (let ([futures (flatten (for/list ([subset (in-list subsets)])
>                            (for/list ([label (in-list (list 0 1))])
>                              (future (lambda ()
>                                        (calc-proportion subset
>                                                         label
> label-column-index))))))])
>    (for/sum ([a-future (in-list futures)])
>      (touch a-future))))
>There always seems to be something blocking, so that only one core is used by 
>the futures. Creating places is too expensive, so maybe I could create places 
>at the very beginning before my program runs and always re-use those.

You don't show the code for 'calc-proportion'  [not that that
necessarily would help much].  There are many conditions that prevent
futures from being executed in parallel - it's best if the code is
purely computation ... almost anything else and you're asking for

The future-visualizer can help you figure out what's blocking them.


You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to