bdelespierre / php-kmeans

PHP K-Means
MIT License
91 stars 41 forks source link

Multithread for the win #29

Open bdelespierre opened 3 years ago

bdelespierre commented 3 years ago

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 commented 3 years ago

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

battlecook commented 3 years ago

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

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

bdelespierre commented 3 years ago

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

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

Looks amazing :star_struck:

battlecook commented 3 years ago

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

bdelespierre commented 3 years ago

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.

battlecook commented 3 years ago

Great. Let's go ahead with your plan!