Re: [patch] krsort() ext/standard/array.c

From: Date: Thu, 13 Dec 2001 07:50:00 +0000
Subject: Re: [patch] krsort() ext/standard/array.c
References: 1 2 3  Groups: php.dev 
Request: Send a blank email to php-dev+get-73471@lists.php.net to get a copy of this message
On December 12, 2001 07:33 am, Andrei Zmievski wrote: > On Wed, 12 Dec 2001, Sterling Hughes wrote: > > And those functions would be? :) Are you talking about > > regularly used functions such as strlen(), etc.? > > Functions like count(), for example, that people tend to use in a > loop unnecessarily. > > > I agree that zend_basic_functions.c should remain abstracted, I > > guess where we draw the line is a bit fuzzy to me? What are > > your thoughts as to what functions should remain > > un-zend-parse-parameterized (say *that* 10 times fast :). > > Yes, the distinction is not clear. Perhaps, the person who does the > conversion for each module could do some benchmark tests on their > programs and see what might need to be adjusted. I did a simple test with krsort before and after zend_parse_parameters. See the attached files for information on the changes that I made and the test that I used. In this case, it looks like we face at most about a 0.0001 second penalty per function call for using zend_parse_parameters. This is based on the data below: (4.762 seconds - 3.704 seconds) / 10000 calls to krsort) Profiling would probably be a better choice, however, I am having a few troubles getting profiling going with the PHP source. :) As always, correction and comments welcome. --- With zend_parse_parameters(): real 0m4.762s user 0m4.710s sys 0m0.030s real 0m4.738s user 0m4.700s sys 0m0.030s real 0m4.726s user 0m4.700s sys 0m0.020s Without zend_parse_parameters(): real 0m3.704s user 0m3.620s sys 0m0.040s real 0m3.833s user 0m3.660s sys 0m0.020s real 0m3.764s user 0m3.650s sys 0m0.010s -- Zak Greant PHP Quality Assurance Team http://qa.php.net/ "We must be the change we wish to see." - M. K. Ghandi

<?php foreach (file ('/usr/local/src/data.txt') as $k => $v) { $array[$v] = $k; } define (MAX, 10000); for ($x=0; $x < MAX; ++$x) { $data = $array; krsort ($data); } ?> Attachment: [text/x-diff] krsort changes diff.txt
CODING_STANDARDS CREDITS CVS ChangeLog ChangeLog.1999.gz ChangeLog.2000.gz EXTENSIONS INSTALL LICENSE Makefile Makefile.in NEWS README.CVS-RULES README.EXTENSIONS README.EXT_SKEL README.PARAMETER_PARSING_API README.QNX README.SELF-CONTAINED-EXTENSIONS README.STREAMS README.Zeus RELEASE_PROCESS TODO TODO-4.2.txt TSRM Zend acconfig.h acconfig.h.in acinclude.m4 aclocal.m4 apidoc-zend.txt apidoc.txt build buildconf buildmk.stamp config.guess config.log config.nice config.status config.sub config_vars.mk configure configure.in cvsclean dynlib.m4 ext footer generated_lists genfiles header install-sh libphp4.la libs libtool ltmain.sh main makedist makerpm missing mkinstalldirs modules pear php.ini-dist php.ini-recommended php4.gif php4.spec php4.spec.in php_version.h regex run-tests.php sapi scripts snapshot stamp-h.in stub.c stub.lo stub.o tests win32
« previous php.dev (#73471) next »