Re: [PATCH] DB::oci8::fetchRow() should use fetchInto()
| From: | Roman Neuhauser | Date: | Tue, 10 Jun 2003 17:41:37 +0000 |
| Subject: | Re: [PATCH] DB::oci8::fetchRow() should use fetchInto() | ||
| References: | 1 2 3 4 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-17272@lists.php.net to get a copy of this message | ||
# cox@idecnet.com / 2003-06-10 19:05:10 +0200:
> > > DB_result::fetchRow() calls internally fetchInto(), so this func gets
> > > never called.
> >
> > I have another question, then: why fetchInto(), when passing arrays
> > by reference is (excuse me) slow as hell?
>
> Did you bench it or have some tests to demostrate that?
Besides the fact that it's written in big friendly letters in the
ZendAPI docs? :)
Yes, I've benched it, it was ~10x (4.0.6 IIRC, I don't remember the
exact ratio).
Hmm, I tried again, and with 4.3.1 the difference is really small:
roman@freepuppy ~ 1030:0 > for s in v r; do echo $s; for i in {1..10}; do time php
tmp/scratch2 -$s 50000; done; done
v
php tmp/scratch2 -$s 50000 0.33s user 0.02s system 99% cpu 0.346 total
php tmp/scratch2 -$s 50000 0.34s user 0.00s system 98% cpu 0.342 total
php tmp/scratch2 -$s 50000 0.34s user 0.00s system 97% cpu 0.344 total
php tmp/scratch2 -$s 50000 0.33s user 0.00s system 93% cpu 0.352 total
php tmp/scratch2 -$s 50000 0.31s user 0.01s system 92% cpu 0.347 total
php tmp/scratch2 -$s 50000 0.34s user 0.00s system 98% cpu 0.348 total
php tmp/scratch2 -$s 50000 0.33s user 0.01s system 97% cpu 0.345 total
php tmp/scratch2 -$s 50000 0.34s user 0.01s system 98% cpu 0.351 total
php tmp/scratch2 -$s 50000 0.34s user 0.00s system 99% cpu 0.346 total
php tmp/scratch2 -$s 50000 0.30s user 0.01s system 90% cpu 0.344 total
r
php tmp/scratch2 -$s 50000 0.36s user 0.02s system 93% cpu 0.399 total
php tmp/scratch2 -$s 50000 0.40s user 0.00s system 98% cpu 0.406 total
php tmp/scratch2 -$s 50000 0.40s user 0.00s system 98% cpu 0.403 total
php tmp/scratch2 -$s 50000 0.40s user 0.00s system 98% cpu 0.405 total
php tmp/scratch2 -$s 50000 0.37s user 0.00s system 90% cpu 0.404 total
php tmp/scratch2 -$s 50000 0.38s user 0.00s system 94% cpu 0.403 total
php tmp/scratch2 -$s 50000 0.39s user 0.01s system 99% cpu 0.402 total
php tmp/scratch2 -$s 50000 0.38s user 0.02s system 98% cpu 0.405 total
php tmp/scratch2 -$s 50000 0.38s user 0.01s system 97% cpu 0.399 total
php tmp/scratch2 -$s 50000 0.35s user 0.01s system 89% cpu 0.402 total
roman@freepuppy ~ 1031:0 > php -v
PHP 4.3.1 (cli) (built: May 21 2003 13:56:00)
Copyright (c) 1997-2002 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2002 Zend Technologies
roman@freepuppy ~ 1032:1 > cat tmp/scratch2
<?php
function byref(&$a)
{
static $b;
if (is_null($b)) {
$b = range(10, 10);
}
$a = $b;
}
function byval($a)
{
static $b;
if (is_null($b)) {
$b = range(10, 10);
}
return $b;
}
$a = range(1, 10);
if ('-r' == $argv[1]) {
for ($i = 0; $i < $argv[2]; $i++) {
byref($a); $b = $a;
}
}
if ('-v' == $argv[1]) {
for ($i = 0; $i < $argv[2]; $i++) {
$b = byval($a);
}
}
--
If you cc me or remove the list(s) completely I'll most likely ignore
your message. see http://www.eyrie.org./~eagle/faqs/questions.html