Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:68755 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 91507 invoked from network); 30 Aug 2013 19:30:11 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 30 Aug 2013 19:30:11 -0000 Received: from [127.0.0.1] ([127.0.0.1:25061]) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ECSTREAM id 9B/9C-32511-3C2F0225 for ; Fri, 30 Aug 2013 15:30:11 -0400 Authentication-Results: pb1.pair.com smtp.mail=delong.j@fb.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=delong.j@fb.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain fb.com designates 66.220.155.139 as permitted sender) X-PHP-List-Original-Sender: delong.j@fb.com X-Host-Fingerprint: 66.220.155.139 outmail005.ash2.facebook.com Received: from [66.220.155.139] ([66.220.155.139:40314] helo=mx-out.facebook.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 6F/AA-32511-F40E0225 for ; Fri, 30 Aug 2013 14:11:28 -0400 Received: from [10.4.159.29] ([10.4.159.29:58407] helo=facebook.com) by 10.51.203.23 (envelope-from ) (ecelerity 2.2.3.50 r(45166/45167)) with ESMTP id C4/6B-16096-C40E0225; Fri, 30 Aug 2013 11:11:24 -0700 Received: from devbig005.prn1.facebook.com (localhost.localdomain [127.0.0.1]) by devbig005.prn1.facebook.com (Postfix) with ESMTP id 80A2B2110140; Fri, 30 Aug 2013 11:11:24 -0700 (PDT) Received: (from jdelong@localhost) by devbig005.prn1.facebook.com (8.13.8/8.13.8/Submit) id r7UIBOYC002667; Fri, 30 Aug 2013 11:11:24 -0700 X-Authentication-Warning: devbig005.prn1.facebook.com: jdelong set sender to delong.j@fb.com using -f Date: Fri, 30 Aug 2013 11:11:24 -0700 To: Leigh Cc: Anthony Ferrara , internals@lists.php.net Message-ID: <20130830181124.GA27417@fb.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.2i Subject: Re: [PHP-DEV] Re: [DRAFT] [RFC] Function autoloading From: delong.j@fb.com (Jordan DeLong) On Fri, Aug 30, 2013 at 05:13:05PM +0100, Leigh wrote: > On Aug 30, 2013 1:31 PM, "Anthony Ferrara" 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