Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:89476 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 71109 invoked from network); 28 Nov 2015 01:30:04 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 Nov 2015 01:30:04 -0000 Authentication-Results: pb1.pair.com smtp.mail=anatol.php@belski.net; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=anatol.php@belski.net; sender-id=unknown Received-SPF: error (pb1.pair.com: domain belski.net from 85.214.73.107 cause and error) X-PHP-List-Original-Sender: anatol.php@belski.net X-Host-Fingerprint: 85.214.73.107 klapt.com Received: from [85.214.73.107] ([85.214.73.107:51788] helo=h1123647.serverkompetenz.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 14/9C-04444-C9309565 for ; Fri, 27 Nov 2015 20:30:04 -0500 Received: from w530phpdev (pD9FD2024.dip0.t-ipconnect.de [217.253.32.36]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by h1123647.serverkompetenz.net (Postfix) with ESMTPSA id 9D94B78A24A; Sat, 28 Nov 2015 02:30:01 +0100 (CET) To: "'Pascal KISSIAN'" , References: <009301d128fa$bb2675d0$31736170$@lool.fr> In-Reply-To: <009301d128fa$bb2675d0$31736170$@lool.fr> Date: Sat, 28 Nov 2015 02:29:57 +0100 Message-ID: <004601d1297c$4d2997b0$e77cc710$@belski.net> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Outlook 15.0 Thread-Index: AQNAx7Lc+3hQqsfh+JQhDAFvMI653ZvRZADw Content-Language: en-us Subject: RE: [PHP-DEV] Proof of Concept : 3.5x and more Performance Boost for php7 using 4 cores From: anatol.php@belski.net ("Anatol Belski") Hi Pascal, > -----Original Message----- > From: Pascal KISSIAN [mailto:php-mailing-list@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