in reply to I thought MCE::Map is faster than usual map. What am I missing?

MCE is cool, but just adds a convenient communication layer to adult child OS perl processes spawned via fork. If you want real OS threads (what most of the non-Perl world considers threads), you'll need to look at something like Inline::C + OpenMP + Alien::OpenMP or PDL::ParallelCPU (pthreads).

Given what I consider the semantics of map, you may also think about looking at Parallel::ForkManager::Segmented which gives some convenient sugar for chunking up work among child processes (on top of the awesome Parallel::ForkManager - and I think will reuse them without unduly aborting them prematurely (thus saving the overhead of spawning new processes) - and if doesn't maintain an actual pool, you're at lease amortizing the start up time over multiple items processed rather than one new process per item.

> I tried it with various versions of perl (5.16, 5.24, 5.32 and 5.34) and I get similar results

This is because you're likely testing on the same hardware and OS, which means same forking overhead. It's not rocket surgery.

  • Comment on Re: I thought MCE::Map is faster than usual map. What am I missing?
  • Download Code