Why does Clojure hang after having performed my calculations?

后端 未结 1 475
鱼传尺愫
鱼传尺愫 2021-01-04 04:00

I\'m experimenting with filtering through elements in parallel. For each element, I need to perform a distance calculation to see if it is close enough to a target point. Ne

1条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-04 04:48

    You need to call shutdown-agents to kill the threads backing the threadpool used by pmap.

    About pfilter, it should work but run slower than filter, since your predicate is simple. Parallelization isn't free so you have to give each thread moderately intensive tasks to offset the multithreading overhead. Batch your items before filtering them.

    0 讨论(0)
提交回复
热议问题