#47295 [NEW]: Namespace fall back to global function/constant - computation speed

From: Date: Tue, 03 Feb 2009 20:50:17 +0000
Subject: #47295 [NEW]: Namespace fall back to global function/constant - computation speed
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-1797@lists.php.net to get a copy of this message
From:             david dot thalmann at gmail dot com
Operating system: Any
PHP version:      Irrelevant
PHP Bug Type:     Documentation problem
Bug description:  Namespace fall back to global function/constant - computation speed

Description:
------------
Hello!

As mentioned in the documentation[1]: "PHP will fall back to global
functions or constants if a namespaced function or constant does not
exist". A "fall back" implies (?) more computation (in this case going
through the priority list) which further implies a loss of
speed/performance.

It should be mentioned in the doc - if my assumption is true (based on a
excerp of the internals-mailinglist[2]), that calling a built in function
fully qualified (\built_in_function()) should be prefered over unqualified
(built_in_function()).

I know, this is just a small note to the doc, but built-in functions are
used very often, so this could bring a lot of speed on medium to large
projects.

May add this to the doc when 5.3 is out and/or when it's clear how, what
and when a fallback will be used (see discussion[3]).

Regards
David

[1] http://www.php.net/namespaces.fallback
[2] http://news.php.net/php.internals/41696
[3] http://wiki.php.net/rfc/namespaceresolution


-- 
Edit bug report at http://bugs.php.net/?id=47295&edit=1
-- 
Try a CVS snapshot (PHP 5.2):        http://bugs.php.net/fix.php?id=47295&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):        http://bugs.php.net/fix.php?id=47295&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):        http://bugs.php.net/fix.php?id=47295&r=trysnapshot60
Fixed in CVS:                        http://bugs.php.net/fix.php?id=47295&r=fixedcvs
Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=47295&r=needdocs
Fixed in release:                    http://bugs.php.net/fix.php?id=47295&r=alreadyfixed
Need backtrace:                      http://bugs.php.net/fix.php?id=47295&r=needtrace
Need Reproduce Script:               http://bugs.php.net/fix.php?id=47295&r=needscript
Try newer version:                   http://bugs.php.net/fix.php?id=47295&r=oldversion
Not developer issue:                 http://bugs.php.net/fix.php?id=47295&r=support
Expected behavior:                   http://bugs.php.net/fix.php?id=47295&r=notwrong
Not enough info:                     http://bugs.php.net/fix.php?id=47295&r=notenoughinfo
Submitted twice:                     http://bugs.php.net/fix.php?id=47295&r=submittedtwice
register_globals:                    http://bugs.php.net/fix.php?id=47295&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=47295&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=47295&r=dst
IIS Stability:                       http://bugs.php.net/fix.php?id=47295&r=isapi
Install GNU Sed:                     http://bugs.php.net/fix.php?id=47295&r=gnused
Floating point limitations:          http://bugs.php.net/fix.php?id=47295&r=float
No Zend Extensions:                  http://bugs.php.net/fix.php?id=47295&r=nozend
MySQL Configuration Error:           http://bugs.php.net/fix.php?id=47295&r=mysqlcfg



Thread (2 messages)

« previous php.doc.bugs (#1797) next »