Si php avait un cache il n'y aurait pas des caches opcode à rajouter ;-) ----------------------------------------- Régis Houssin Tél. +33633020797 http://www.dolibarr.fr http://www.dolibox.fr
Le 31 juil. 2012 à 23:09, Christophe Battarel <[email protected]> a écrit : > I'm very surprised by the results of Regis tests. And a bit disappointed by > them ! doesnt php use any cache before including files ? it's pretty amazing. > -- > Responsable technique > SARL altairis > www.altairis.fr > 09 52 71 70 96 > Le 31/07/2012 22:59, Laurent Destailleur (eldy) a écrit : >> >> Not that however that a having a lot of require and include is not really a >> problem when this is done onto a file that exists. >> Problem is above all for is_file or require or include on file that does not >> exists. >> >> But reducing time is always welcome. >> Not that for require on top of page, adding a test on a class is useless >> because we know that file was not loaded. >> >> >> >> Le 31/07/2012 18:48, Régis Houssin a écrit : >>> Hi >>> >>> I did a little test performance between require_once and class_exists. >>> we gain 50% performance gain using class_exists >>> see the figures below (tested separately) >>> >>> class_exists condition will check only if the class is already included. >>> A require_once will read the file, read file, create the hash, the hash >>> compare to other hashes, and finally decide. >>> >>> $t1 = microtime(true); >>> $nbloops = 3000; >>> $file1 = 'compta/facture/class/facture.class.php'; >>> $file2 = 'societe/class/societe.class.php'; >>> $file3 = 'comm/propal/class/propal.class.php'; >>> >>> for ($i=0;$i<$nbloops;$i++){ >>> if (! class_exists('Facture')) >>> require $file1; >>> if (! class_exists('Societe')) >>> require $file2; >>> if (! class_exists('Propal')) >>> require $file3; >>> } >>> echo 'script executed in '.(microtime(true)-$t1).' s'; >>> //script executed in 0.0548310279846 s >>> >>> for ($i=0;$i<$nbloops;$i++){ >>> require_once $file1; >>> require_once $file2; >>> require_once $file3; >>> } >>> echo 'script executed in '.(microtime(true)-$t1).' s'; >>> //script executed in 0.134128093719 s >>> >>> >>> >>> Cordialement, >>> -- >>> Régis Houssin >>> --------------------------------------------------------- >>> Cap-Networks >>> Cidex 1130 >>> 34, route de Gigny >>> 71240 MARNAY >>> FRANCE >>> VoIP: +33 1 83 62 40 03 >>> GSM: +33 6 33 02 07 97 >>> Web: http://www.cap-networks.com/ >>> Email: [email protected] >>> >>> Dolibarr developer: [email protected] >>> Web Portal: http://www.dolibarr.fr/ >>> SaaS offers: http://www.dolibox.fr/ >>> Shop: http://www.dolistore.com/ >>> Development platform: https://doliforge.org/ >>> --------------------------------------------------------- >>> >>> >>> _______________________________________________ >>> Dolibarr-dev mailing list >>> [email protected] >>> https://lists.nongnu.org/mailman/listinfo/dolibarr-dev >> >> >> -- >> Eldy (Laurent Destailleur). >> --------------------------------------------------------------- >> EMail: [email protected] >> Web: http://www.destailleur.fr >> >> Dolibarr (Project leader): http://www.dolibarr.org >> To make a donation for Dolibarr project via Paypal: [email protected] >> AWStats (Author) : http://awstats.sourceforge.net >> To make a donation for AWStats project via Paypal: [email protected] >> AWBot (Author) : http://awbot.sourceforge.net >> CVSChangeLogBuilder (Author) : http://cvschangelogb.sourceforge.net >> >> >> _______________________________________________ >> Dolibarr-dev mailing list >> [email protected] >> https://lists.nongnu.org/mailman/listinfo/dolibarr-dev > > _______________________________________________ > Dolibarr-dev mailing list > [email protected] > https://lists.nongnu.org/mailman/listinfo/dolibarr-dev
_______________________________________________ Dolibarr-dev mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/dolibarr-dev
