Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:40478 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 74133 invoked from network); 12 Sep 2008 04:40:27 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 Sep 2008 04:40:27 -0000 Authentication-Results: pb1.pair.com header.from=greg@chiaraquartet.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=greg@chiaraquartet.net; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain chiaraquartet.net from 208.83.222.18 cause and error) X-PHP-List-Original-Sender: greg@chiaraquartet.net X-Host-Fingerprint: 208.83.222.18 unknown Linux 2.6 Received: from [208.83.222.18] ([208.83.222.18:51162] helo=mail.bluga.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 12/83-49770-9B2F9C84 for ; Fri, 12 Sep 2008 00:40:26 -0400 Received: from mail.bluga.net (localhost.localdomain [127.0.0.1]) by mail.bluga.net (Postfix) with ESMTP id 9C42DC0E2E0; Thu, 11 Sep 2008 21:39:36 -0700 (MST) Received: from [192.168.0.106] (CPE-76-84-4-101.neb.res.rr.com [76.84.4.101]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.bluga.net (Postfix) with ESMTP id 4B9C0C0E2DF; Thu, 11 Sep 2008 21:39:36 -0700 (MST) Message-ID: <48C9F2C5.3050202@chiaraquartet.net> Date: Thu, 11 Sep 2008 23:40:37 -0500 User-Agent: Thunderbird 2.0.0.16 (X11/20080724) MIME-Version: 1.0 To: Stanislav Malyshev CC: internals@lists.php.net References: <48C59D5C.4050507@chiaraquartet.net> <48C5A909.4030502@zend.com> <48C602D5.6020704@chiaraquartet.net> <48C6A6AA.7050003@zend.com> In-Reply-To: <48C6A6AA.7050003@zend.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: ClamAV using ClamSMTP Subject: Re: [PATCH] Re: [PHP-DEV] namespace examples (solving name resolutionorder issues) From: greg@chiaraquartet.net (Gregory Beaver) Stas and I continued our discussion off list, and decided to pop it back on the list, so here is 1 message, another to follow. Greg === Stanislav Malyshev wrote: > > Hi! > > >> >> ...the message you replied to? > > > > I must be missing something here. In my last reply, I raised a number > > of points, including having unqualified names resolve only to > > namespace and relation of this to functions and constants. I do not > > see these points addressed or discussed anywhere in your email. Some > > less important points - like tradeoffs you need to take for working > > with internal classes (second reply part in my email) - weren't > > mentioned either. Hi Stas, In your last reply, you asserted that the only solution was to always resolve unqualified names to namespace::name. The patch I sent actually shows that this is unnecessary. > > > > Also, I do not see the explanation how this patch is different from > > the last one and how the difference in the speed is achieved - you > > just claim it has gone from 466x to 5.2x but I did not find any > > explanation about what is the change allowed you to do this. I would > > like to understand what this change is and to do that from reading a > > patch is kind of hard and I can't be sure what I understood was > > actually your intent. Could you explain it? > > You could also contact me on IM or IRC if you prefer. Basically, the patch does 2 things 1) resolution order is changed to: foo.php: $a = new foo(); a) does namespace::foo class exist? b) try to autoload namespace::foo c) try to locate internal class ::foo 2) if internal class ::foo is found, then cache this information so that if another reference to the foo class occurs in foo.php, resolution short circuits to: a) use internal class ::foo This second point is why the slowdown went from ridiculous to slight. Since your primary complaint about the resolution order is performance, and the patch removes the performance problem, this makes your suggestion of never checking internal classes unnecessary. That was the point of my previous email with the patch. Clear now? Greg