Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:11618 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 15066 invoked by uid 1010); 29 Jul 2004 15:06:02 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 14999 invoked by uid 1007); 29 Jul 2004 15:06:02 -0000 Message-ID: <20040729150602.14998.qmail@pb1.pair.com> To: internals@lists.php.net References: <20040729021337.73894.qmail@pb1.pair.com> <200407291117.09573.lpedretti@suserver.com> <1091112020.18112.15.camel@blobule.suds> Date: Thu, 29 Jul 2004 08:04:53 -0700 Lines: 20 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1437 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 X-Posted-By: 64.142.6.231 Subject: Re: [PHP-DEV] GOTO operator From: pollita@php.net ("Sara Golemon") > Note > ---- > Goto jumping is O(1) if getting to the jump destination doesn't require > a hash lookup due to "wuring" of the destination at compile time. If a > hash lookup is required then it is probably something like O(lg n) which > is still superior in efficiency to O(n). Additionally, while it is true > that an O(lg n) lookup might be necessary at compile time to find the > pointer to the labeled code block, this is a one time event and has > little bearing on the efficiency overall when during runtime the goto > might be hit thousands or millions of times. > *this* implementation of GOTO requires a hash lookup, however it could be reworked to use the same backpatching as the ZEND_JMP ops used with conditional statements. While doing that would speed execution time by skipping the hash lookup, it'd slow compile time and remove the ability to use complex expressions as goto targets (i.e. goto "foo$i"; ). -Sara