Re: [PHP-PEAR] News from the PHPLib and Pear Benchmark-Front

[email protected] (Christian Stocker) Wed, 7 Mar 2001 15:44:12 +0100 (CET)
Newsgroups php.pear
Organization Nomad Online Agents
Message-ID <[email protected]>
Hi

> the include_once statement should only be evaluated *once* ?

Yes it is.

> Is the evaluation-time the connect() function needs, always the
> same, if you call it multiple times in one script? (only the database-
> type must be the same, not the database itself)

just did one connect in the script.

> I was not able to figure out, how many times you called connect() to measure
> the differences on your result.html

the script can be found at http://www.nomad.ch/php/benchmarkdb.phps

> and i would guess a second call to include_once() should be much
> faster.

yes should, because it's not included a second time if you use
include_once() (hence the name, i assume :) )

> AFAIR you need to connect only once in Pear::DB and can use this object for
> multiple queries, since you get a distinct result handle for every query in
> Pear::DB. Unlike in phplib where you have to use mulitple instances of
> DB_Sql to do queries in nested loops.

as i can remember, that's right. but didn't test, how this affects speed.

> So perhaps connect() does not need that
> much optimization, since it should not be a hotspot in you application.

as i wrote, it's not the connect() function itself, it's the include of
the db-generic files which is slow (these files seem to take more time to
compile than the phplib-files). and yes, you only have to do that once, so
if you have a lot of queries, the time it takes for the include maybe does
not really matter. but if you only have one or two simple queries (if i
use the cache classes, then i only have one query per cached page), it has
quite an impact in term of "pages per second" delivered compared to
phplib.

chregu