# Pmap slow compared to map

**URL:** <https://discourse.julialang.org/t/pmap-slow-compared-to-map/14691>\
**Category:** General Usage\
**Tags:** performance, parallel\
**Created:** [September 8, 2018, 2:23am UTC](https://discourse.julialang.org/t/pmap-slow-compared-to-map/14691 "2018-09-08T02:23:16Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![kaskarn](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kaskarn/32/7228_2.png) [@kaskarn](https://discourse.julialang.org/u/kaskarn)\
**Post date:** [September 10, 2018, 12:40pm UTC](https://discourse.julialang.org/t/pmap-slow-compared-to-map/14691/2 "2018-09-10T12:40:07Z")

</div>

Hello,

Your issue is similar to [mine](https://discourse.julialang.org/t/pmap-performance-regression-pmap-x-f-x-y-x-creates-copies-of-y/14221/9) from last month; basically, closures in `pmap` are slow when passing large objects (like your 100x100 `im1` and `im2` arrays). There is a [github issue](https://github.com/JuliaLang/julia/issues/28949) with a bit more detail.

The simplest way to fix the issue seems be using the cache pool:

```julia
pool = CachingPool(workers())
pmap(pool, x -> crossCorr_par(im1_shared, im2_shared, x), iterations)

```

It looks like the `CachingPool` approach was intended to become default in pmap, based on [this pull request from last year](https://github.com/JuliaLang/julia/pull/22843), but the proposed change remains under review after a year.

---

_[View the full topic](https://discourse.julialang.org/t/pmap-slow-compared-to-map/14691)._
