If I use the following bootstrap file:

<BEGIN>
<?php
error_reporting(E_ALL|E_STRICT);

/**
 *  Magik constants
 */
define ('DS', DIRECTORY_SEPARATOR);
define ('PS', PATH_SEPARATOR);
define ('ROOT', dirname(__FILE__));
define ('DB', ROOT . DS . 'database' . DS . 'magik.db3');

/**
 * Set the PHP include path
 */
/*
ini_set('include_path', ini_get('include_path')
. PS . '..' . DS . 'ZendFramework' . DS . 'library'
. PS . '.' . DS . 'library'
. PS . '.' . DS . 'application' . DS . 'models'
. PS . '.' . DS . 'application' . DS . 'config'
. PS . '.' . DS . 'widgets'
);
*/
set_include_path(PS . '..' . DS . 'ZendFramework' . DS . 'library'
. PS . '.' .DS . 'library' . DS
. PS . '.' .DS . 'application' . DS . 'models'
. PS . '.' .DS . 'application' . DS . 'config'
. PS . '.' .DS . 'widgets'
. PS . get_include_path()
);

/**
 * Autoload required Zend Framework classes
 */
require_once 'Zend/Loader.php';
Zend_Loader::registerAutoload();

$config = new Zend_Config_Ini('magik.ini');    

date_default_timezone_set('Europe/London');

/**
 * Set up database
 */
$db = Zend_Db::factory('PDO_SQLITE', array('dbname' => DB));
Zend_Db_Table_Abstract::setDefaultAdapter($db);

/**
 * Set up controller
 */
$controller = Zend_Controller_Front::getInstance();

$controller->setControllerDirectory(ROOT . DS . 'application' . DS .
'controllers')
->throwExceptions(false)
->setParam('config', $config)
->registerPlugin(new Magik_Plugin_Logger())
->registerPlugin(new Magik_Plugin_Language());
$route = $controller->getRouter(); // Returns a rewrite router by default
$route->addRoute('load', new Zend_Controller_Router_Route('load/:name',
array(
    'name' => 'Default',
    'controller' => 'load',
    'action' => 'application')
));

/**
 * Go!
 */
$controller->dispatch(); 
<END>

I get the following results, lines 2,3,4 & 7 are using set_include_path,
lines 1,5,6 & 8 are using ini_set



NO.            Starred  OffSet     Timeline  Duration(s)  Method  Result
Received  Type       URL                      RedirectURL  
-  00:00:00.000    firefox.exe[5324]  (Count=8, Sent=4.22 K, Received=2.75
K, ElapsedTime=19.398 s)

   1         False    +0.000 s             0.150 s      GET     200     344
text/html  http://localhost/Magik/               
   2         False    +1.452 s             0.070 s      GET     200     343
text/html  http://localhost/Magik/               
   3         False    +2.624 s             0.070 s      GET     200     343
text/html  http://localhost/Magik/               
   4         False    +3.766 s             0.070 s      GET     200     343
text/html  http://localhost/Magik/               
   5         False    +16.694 s            0.121 s      GET     200     344
text/html  http://localhost/Magik/               
   6         False    +17.515 s            0.120 s      GET     200     343
text/html  http://localhost/Magik/               
   7         False    +18.477 s            0.050 s      GET     200     343
text/html  http://localhost/Magik/               
   8         False    +19.258 s            0.140 s      GET     200     343
text/html  http://localhost/Magik/               

-----Original Message-----
From: David Goodwin [mailto:[EMAIL PROTECTED] 
Sent: 10 April 2008 16:16
To: [email protected]
Cc: Robert Castley
Subject: Re: [fw-general] Little ZF bootstrap speed tip

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Robert Castley wrote:
| I have found out today that by using ini_set in your bootstrap is 
| slower than using set_include_path
|
| Using HTTP Analyzer I achieve the following results:
|
| Apache 2.2.8
| PHP 5.2.5
| Windows XP
| FF 2
|
| ini_set average request time 0.345s
|
|
| set_include_path average request time 0.160s
|
|
| On average about 50% saving.
|
| - Robert


I think your test was flawed; at least on my Linux box which is otherwise
the same as your setup (ish), I can do 10000 ini_set('include_path', 'xxx')
and 10000 set_include_path()'s in almost exactly the same time.

Your time discrepancy is probably therefore due to random freaks of network
traffic...


Interestingly, calling ini_set('include_path', '') doesn't work, and it (the
include_path) remains unchanged.

Code @ http://pastebin.akrabat.com/117

thanks
David.

- --
~ David Goodwin                          Pale Purple Limited
~ Office: 0845 0046746                   Mobile: 07792380669
~ http://www.palepurple.co.uk            Company No: 5580814
~ 'Business Web Application Development and Training in PHP'
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFH/i8U/ISo3RF5V6YRAtz8AJ4jvvx+oE27EaB3ts+Zyf8cKcHT2QCfaZVv
zVklIizmPAq2q+veyExtJz0=
=JoiD
-----END PGP SIGNATURE-----

________________________________________________________________________
This email has been scanned for all known viruses by the MessageLabs Email
Security Service and the Macro 4 plc internal virus protection system.
________________________________________________________________________


________________________________________________________________________
This email has been scanned for all known viruses by the MessageLabs Email 
Security Service and the Macro 4 plc internal virus protection system.
________________________________________________________________________

Reply via email to