Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:96228 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 73268 invoked from network); 4 Oct 2016 15:34:37 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Oct 2016 15:34:37 -0000 Authentication-Results: pb1.pair.com header.from=thruska@cubiclesoft.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=thruska@cubiclesoft.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain cubiclesoft.com designates 149.56.142.28 as permitted sender) X-PHP-List-Original-Sender: thruska@cubiclesoft.com X-Host-Fingerprint: 149.56.142.28 28.ip-149-56-142.net Received: from [149.56.142.28] ([149.56.142.28:36362] helo=28.ip-149-56-142.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id DF/56-06241-D0CC3F75 for ; Tue, 04 Oct 2016 11:34:37 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: thruska@cubiclesoft.com) with ESMTPSA id C017C3E848 To: Pascal KISSIAN , =?UTF-8?Q?'Lauri_Kentt=c3=a4'?= References: <004101d21e33$124edf90$36ec9eb0$@lool.fr> <3bc3c57695cdf6207724db47e6dbbbab@koti.fimnet.fi> <000401d21e4c$3e71d140$bb5573c0$@lool.fr> Cc: internals@lists.php.net Message-ID: <64913a01-7abf-0c9b-ffc2-007e9ac0636b@cubiclesoft.com> Date: Tue, 4 Oct 2016 08:34:30 -0700 User-Agent: Mozilla/5.0 (X11; Linux i686; rv:11.0) Gecko/20120327 Thunderbird/11.0.1 MIME-Version: 1.0 In-Reply-To: <000401d21e4c$3e71d140$bb5573c0$@lool.fr> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] Feature Request: inline pseudo-instruction From: thruska@cubiclesoft.com (Thomas Hruska) On 10/4/2016 7:33 AM, Pascal KISSIAN wrote: >> -----Message d'origine----- >> De : Lauri Kenttä [mailto:lauri.kentta@gmail.com] >> Envoyé : mardi 4 octobre 2016 16:21 >> À : Pascal KISSIAN >> Cc : internals@lists.php.net >> Objet : Re: [PHP-DEV] Feature Request: inline pseudo-instruction >> >> On 2016-10-04 14:33, Pascal KISSIAN wrote: >>> I have an application where a small file is included at multiple >>> places. >>> >>> The include is done about an average of 100.000 times . >> >> 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. >> >> -- >> Lauri Kenttä > > 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. Your code definitely needs refactoring then. A class sounds more appropriate in this case. You needed to refactor back around 3 nested for-loops. 6 nested for-loops is a disaster. What you've described here is indicative of code that needs to be completely scrapped and rebuilt from the ground-up. -- Thomas Hruska CubicleSoft President I've got great, time saving software that you will find useful. http://cubiclesoft.com/