php-kmeans icon indicating copy to clipboard operation
php-kmeans copied to clipboard

Multithread for the win

Open bdelespierre opened this issue 2 years ago • 6 comments

Multithreading the algo would significantly improve the performances. We may use the pthread library when available or proc_open (if none are available well :man_shrugging: )

And it would be so much fun to code :star_struck:

bdelespierre avatar Sep 03 '21 22:09 bdelespierre

Found this article about an implementation in Java (see PARALLELIZATION ANALYSIS). May be useful.

bdelespierre avatar Sep 03 '21 22:09 bdelespierre

If you're considering multithreading, fibers might be an option too.

https://php.watch/versions/8.1/fibers

battlecook avatar Sep 06 '21 01:09 battlecook

If you're considering multithreading, fibers might be an option too.

https://php.watch/versions/8.1/fibers

Looks amazing :star_struck:

bdelespierre avatar Sep 06 '21 11:09 bdelespierre

This feature is available in php 8.1. Unfortunately, 8.1 is still in beta. According to the php team, rc2 (release candidate) will be released on "16 September 2021".

https://www.php.net/index.php#id2021-09-02-1

battlecook avatar Sep 06 '21 11:09 battlecook

I believe we should implement several adapters for concurrency/multithreading.

I think we should start with pThread because it has the best portability and support at the moment.

bdelespierre avatar Sep 07 '21 13:09 bdelespierre

Great. Let's go ahead with your plan!

battlecook avatar Sep 08 '21 13:09 battlecook