Skip to content

Parallel implementation of the higher-order functions map, filter and fold

License

Notifications You must be signed in to change notification settings

functional-php/parallel

Repository files navigation

Parallel

Build Status Scrutinizer Code Quality Code Coverage Average time to resolve an issue Percentage of issues still open Chat on Gitter

Parallel implementation of the higher-order functions map, filter and fold using the phtreads library. This way the computation is distributed across multiple threads so that the whole computational power of the computer can be used.

See the pthreads library requirement. If you are not sure they will be satisfied, install the polyfill.

Installation

composer require functional-php/parallel

Basic Usage

use FunctionalPHP\Parallel as p;

p\map(4, function($i) { return $i + 2; }, [1, 2, 3, 4]);
// will return [3, 4, 5, 6]

p\filter(4, function($i) { return $i % 2 == 0; }, [1, 2, 3, 4]);
// will return [2, 4]

p\fold(4, function($a, $b) { return $a + $b; }, [1, 2, 3, 4], 0);
// will return 10

Testing

You can run the test suite for the library using:

composer test

A test report will be available in the reports directory.

Contributing

Any contribution welcome :

  • Ideas
  • Pull requests
  • Issues

About

Parallel implementation of the higher-order functions map, filter and fold

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages