NAME
Parallel::parallel_map - really parallel calculation in Perl
SYNOPSIS
use Parallel::parallel_map;
my @m2 = parallel_map {$_*2} 1..10000000;
DESCRIPTION
You know from the school that nothing is more simple than 2 x 2 = 4 You know from the university that it is the simplest operation for computer as well (left shift). This module tries outperform and speed up even simplest calculations using all the power of your server CPU cores and familiar map conception.
Here is how it works:
1) finds out how many cpu cores you have,
2) split map work by the number of cores,
3) do it in parallel and
4) after job is done by each thread it merges the results into array if it was called int list context. Otherwise it only calculates values and does not collect the results. That can be used as a parallel for loop.
Sorry, slightly more then 1-2-3.
Interprocess communication is done using plain old temporary files. so it should work everywhere where fork is implemented. Although I have a benchmark that makes Perl crazy when it tries to make garbage collection under Win32 despite some small tests work perfectly. So there is no still heaven on Windows ;) .
Although it's not required, please install Sereal and File::Slurp. That way IPC is done much faster then using Storable capabilities.
EXPORT
parallel_map - that what this module is about
SEE ALSO
Parallel::Loops, MCE, Parallel::DataPipe
AUTHOR
Oleksandr Kharchenko, <okharch@gmail.com>
COPYRIGHT AND LICENSE
Copyright (C) 2013 by Oleksandr Kharchenko
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.16.3 or, at your option, any later version of Perl 5 you may have available.