Re: Re: [DRAFT] [RFC] Function autoloading

From: Date: Fri, 30 Aug 2013 18:11:24 +0000
Subject: Re: Re: [DRAFT] [RFC] Function autoloading
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
On Fri, Aug 30, 2013 at 05:13:05PM +0100, Leigh wrote:
> On Aug 30, 2013 1:31 PM, "Anthony Ferrara" <[email protected]> wrote:
> > For constants and function calls, the benchmark shows that the difference
> > is well within the margin of error for the test (considering variances of
> > 5% to 10% were common in my running of the tests).
> >
> > So hopefully this will dispel any worry about performance regressions in
> > currently defined cases.
> >
> > The times where performance will take a hit, is with undefined functions
> > and constants. Today, an undefined function will fatal error, so this
> > performance hit would be 0, as it would enable something that's not
> > possible today.
> 
> I would assume there is actually potential for performance gain for
> functions being autoloaded in larger codebases when the *_once calls are
> removed that would normally load the common functions files.

Maybe of interest:

We got a performance win from exactly this at Facebook.  We have some
extensions in HHVM to autoload that allowed us to remove almost all
our *_once calls.

We have user code register an "autoload map" with the runtime at the
beginning of most requests (an array mapping class/function names to
which files to load), so we don't normally execute any user code to
figure out which file needs loading.  (There's various other
optimizations to avoid autoload on top of that too.)

I don't know enough about PHP internals to know if that approach would
work as well here, though.

-Jordan


Thread (72 messages)

« previous php.internals (#68755) next »