Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:43150 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 41284 invoked from network); 22 Feb 2009 05:54:38 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 22 Feb 2009 05:54:38 -0000 Authentication-Results: pb1.pair.com smtp.mail=ron@Opus1.COM; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ron@Opus1.COM; sender-id=unknown Received-SPF: pass (pb1.pair.com: domain Opus1.COM designates 192.245.12.8 as permitted sender) X-PHP-List-Original-Sender: ron@Opus1.COM X-Host-Fingerprint: 192.245.12.8 Viola.Opus1.COM OpenVMS 7.2 (Multinet 4.3-4.4 stack) Received: from [192.245.12.8] ([192.245.12.8:4218] helo=Viola.Opus1.COM) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 83/48-64302-C98E0A94 for ; Sun, 22 Feb 2009 00:54:37 -0500 Received: from [192.168.1.2] ([76.115.41.119]) by Opus1.COM (PMDF V6.2-X27 #9830) with ESMTPSA id <01N5RZXFXMGC95QBDN@Opus1.COM>; Sat, 21 Feb 2009 22:54:32 -0700 (MST) Date: Sat, 21 Feb 2009 21:54:30 -0800 In-reply-to: <49A097FE.10205@tekrat.com> To: shire Cc: PHP Internals List , apc-dev@lists.php.net Message-ID: <633918AD-16DE-4B34-A76E-E90A21E325B3@opus1.com> MIME-version: 1.0 X-Mailer: Apple Mail (2.753.1) Content-type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Content-transfer-encoding: 7bit X-Gpgmail-State: !signed References: <49A097FE.10205@tekrat.com> Subject: Re: [PHP-DEV] [RFC] APC/PHP Lazy Loading From: ron@Opus1.COM (Ronald Chmara) On Feb 21, 2009, at 4:10 PM, shire wrote: > I've just checked into APC CVS preliminary support for Lazy Loading > classes and functions. This means that rather than copying > function entries into EG(function_table) and EG(class_table) when > an include happen it will mark the functions/classes as available > and only actually insert them into the tables when they are called. Wait... so if I understand this right, let's envision a code base where, per some random page load, 70 functions are actually called, but, oh, 7,000, or even 700,000, are being included for whatever reason? The speed optimization is in *not* copying a massive amount of things that weren't even needed, or used, in the first place? However, there's still the horribly massive speed hit of semi- loading, and marking, a fairly large amount of unused, un-needed, functions, as available? While I do see, and understand, the performance benefit of such a coding direction, it's not exactly encouraging well designed code. For example: include(site-mega-loader.php); //which kicks off -->include(sub-site-mega-loader.php); //which kicks off --->include(sub-site-application-loader.php); //which kicks off ---->include(sub-site-application-feature-loader.php); //which kicks off ----->include(sub-site-application-function-loader.php); //which kicks off ------>include(sub-site-application-function-loader-function.php); //and the actual code which caused the load? my_custom_site_application_echo( "Hello World"); ?> This.... does not make me happy as a coder. I do see the benefit of lazy loading, I'm just not very comfortable with enabling a philosophy of loading up a massive amount of CPU and RAM with "just in case they're wanted" features and code in the first place. It *should* hurt to load something. Code should not be ever loaded unless needed. It certainly can boost an APC code set such as facebook, where many of those files and functions *will* likely be used in the next 20 minutes or so, but I also fear that it will encourage programmers to load everything they have, every time, just in case they need it.... and 2Gb apache processes (and APC space) can be.... ugly. That being said, I think the idea is good, but the possible mis-uses are potentially tough issues. -Bop