Suggestion to zend-api: some lookahead could make functions calls faster!
| From: | Thies C. Arntzen | Date: | Mon, 15 Nov 1999 18:33:20 +0000 |
| Subject: | Suggestion to zend-api: some lookahead could make functions calls faster! | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-6267@lists.php.net to get a copy of this message | ||
hi,
just an idea:
if a c-function knew the the returned value will be discarded by the
caller (the script) there would be no need to set up
return_value.
reset() for example returns a copy of the 1st array element. i never use
that...
reset($arr); // no need to copy 1st array element into return_value
$first = reset($arr); // set up return_value
even smarter libzend could pass a flag to a c-function telling that the
return-value will just be used as a bool:
$a = key($array); // key() needs to create the return_value completely
if (key($array)) // resturn_value could just be true/false
{
}
i'd also like a new set of first(), current(), next() etc functions that
return a reference to the corresponding array element instead of a copy -
something like r_first() would be ugly - how about &first()?
regards,
tc