Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:96229 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 74898 invoked from network); 4 Oct 2016 15:39:14 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Oct 2016 15:39:14 -0000 Authentication-Results: pb1.pair.com smtp.mail=bobwei9@hotmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=bobwei9@hotmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain hotmail.com designates 65.55.111.96 as permitted sender) X-PHP-List-Original-Sender: bobwei9@hotmail.com X-Host-Fingerprint: 65.55.111.96 blu004-omc2s21.hotmail.com Received: from [65.55.111.96] ([65.55.111.96:62094] helo=BLU004-OMC2S21.hotmail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 29/B6-06241-12DC3F75 for ; Tue, 04 Oct 2016 11:39:14 -0400 Received: from BLU436-SMTP253 ([65.55.111.72]) by BLU004-OMC2S21.hotmail.com over TLS secured channel with Microsoft SMTPSVC(7.5.7601.23008); Tue, 4 Oct 2016 08:39:11 -0700 X-TMN: [Upt0DJpNdMS9r+VEn8bOe8KOdYEYC+TX] X-Originating-Email: [bobwei9@hotmail.com] Message-ID: Content-Type: multipart/alternative; boundary="Apple-Mail=_E5F59B10-E105-48E9-BEA7-190B42F3E98A" MIME-Version: 1.0 (Mac OS X Mail 8.2 \(2070.6\)) In-Reply-To: <000401d21e4c$3e71d140$bb5573c0$@lool.fr> Date: Tue, 4 Oct 2016 17:39:04 +0200 CC: PHP internals list References: <004101d21e33$124edf90$36ec9eb0$@lool.fr> <3bc3c57695cdf6207724db47e6dbbbab@koti.fimnet.fi> <000401d21e4c$3e71d140$bb5573c0$@lool.fr> To: Pascal KISSIAN X-Mailer: Apple Mail (2.2070.6) X-OriginalArrivalTime: 04 Oct 2016 15:39:08.0863 (UTC) FILETIME=[727724F0:01D21E55] Subject: Re: [PHP-DEV] Feature Request: inline pseudo-instruction From: bobwei9@hotmail.com (Bob Weinand) --Apple-Mail=_E5F59B10-E105-48E9-BEA7-190B42F3E98A Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" > Am 4.10.2016 um 16:33 schrieb Pascal KISSIAN = : >=20 >> -----Message d'origine----- >> De : Lauri Kentt=C3=A4 [mailto:lauri.kentta@gmail.com]=20 >> Envoy=C3=A9 : mardi 4 octobre 2016 16:21 >> =C3=80 : Pascal KISSIAN >> Cc : internals@lists.php.net >> Objet : Re: [PHP-DEV] Feature Request: inline pseudo-instruction >>=20 >> On 2016-10-04 14:33, Pascal KISSIAN wrote: >>> I have an application where a small file is included at multiple=20 >>> places. >>>=20 >>> The include is done about an average of 100.000 times . >>=20 >> I'm just wondering if you have ever heard of functions? You really = should write a function, include it only once, and then simply call the = function instead of repeatedly >including the file. Calling a function = is a lot faster than including a file. >>=20 >> -- >> Lauri Kentt=C3=A4 >=20 > Function is not appropriate when the "inlined code" has to share 20-30 = local variables ... > Having a function with 30 args, or having to build and access an = array is not very efficient nor natural... > Local variables include 6 nested "for loop" indices and local = variables/arrays needed for the computing. Hey, why do you think are your includes so slow? Apart from the include itself (which in itself is fairly slow due to = filesystem access; or in case with opcache, at the very least copying = the op_array etc.), it does exactly this: building an array and = importing it into the included files scope. Also, 20-30 local variables? That sounds a bit like your code has way = too many responsibilities in one same place. Perhaps you should = restructure your code instead, but the way you describe it, no. If your code is so "hot", that also even function calls would be quite = significant then you should probably really inline your code there as a = perf optimization. Anyway, code with that many variables almost always = can meaningfully refactored. It is not the languages task to optimize insane code ... Bob --Apple-Mail=_E5F59B10-E105-48E9-BEA7-190B42F3E98A--