Re: Feature Request: inline pseudo-instruction

From: Date: Tue, 04 Oct 2016 15:34:30 +0000
Subject: Re: Feature Request: inline pseudo-instruction
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-96228@lists.php.net to get a copy of this message
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 <php-mailing-list@lool.fr> 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/

« previous php.internals (#96228) next »