Hi Pascal,

> -----Original Message-----
> From: Pascal KISSIAN [mailto:php-mailing-l...@lool.fr]
> Sent: Friday, November 27, 2015 11:03 AM
> To: internals@lists.php.net
> Subject: [PHP-DEV] Proof of Concept : 3.5x and more Performance Boost for
> php7 using 4 cores
> Importance: High
> 
> Hi everybody,
> 
> 
> 
> I made a simple test to know if it was possible to speed-up php
performance by
> using parallel programming.
> 
> 
> 
> I modified 2 functions within ./ext/standard/array.c file of PHP-7.0.0RC7
to use
> openmp and added the -fopenmp flag to the compiler flags in the Makefile.
> 
> 
> 
> I modified the php functions  array_sum() and in_array() to do some
> benchmarking.
> 
> I made changes in the php_search_array() function only using the strict
> comparaison.
> 
> To make it work in all cases, you have just to do some cut'n'paste, but
the
> source is easier to read with only 1 change.
> 
> Use :
> 
> OMP_NUM_THREADS=xx /path_to/php test_file.php
> 
> to specify xx, the number of threads to use in your test file
> 
> 
> 
> I got an average speed-up of 3.5 using 4 cores.
> 
> 
> 
> You can find all details:
> 
> .       Test files
> 
> .       Modified source files
> 
> .       Benchmarks
> 
> .       Faq
> 
> .       .
> 
> 
> 
> At  http://poc.yakpro.com/?php7_performance_boost_parallel_computing
> 
> 
> 
> My main goal is to initiate a global thinking, among php core developers,
> concerning the parallel computing and php, at each level:
> 
> -            Core level: For speeding-up functions, but also the
interpreter
> (by parallelizing opcodes pre-fetching for example)
> 
> -            User level: imagine and implement simple and efficient
> primitives to make the php developer comfortable with parallel
programming.
> 
> 
> 
> A multicore php8 or php9?  Wouldn't be cool????
> 
This is very interesting research, thanks for that.

IMO the decision whether and how to use parallel computations should to be
moved into the user space. The main tricky part with it is that there are
very specific cases where such computation would really bring a speedup.
Namely - positive result is semi expected on an appropriate amounts of data
and algorithms. Many cases with smaller amounts of data may and probably
will show worse results than the current implementation. For smaller data,
all the setup the system needs to perform will most likely negate the
advantage of the parallelism. Probably it is hard to provide a smart enough
implementation to handle any kind of situation, but giving more power to an
actual programmer to decide could possibly solve it.

It could make sense to at least add some tests with a more variety of data
amount, with small arrays as well.

Regards

Anatol



-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to