Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:69733 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 76930 invoked from network); 21 Oct 2013 14:33:26 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 21 Oct 2013 14:33:26 -0000 Authentication-Results: pb1.pair.com smtp.mail=pthreads@pthreads.org; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=pthreads@pthreads.org; sender-id=unknown Received-SPF: error (pb1.pair.com: domain pthreads.org from 74.125.82.50 cause and error) X-PHP-List-Original-Sender: pthreads@pthreads.org X-Host-Fingerprint: 74.125.82.50 mail-wg0-f50.google.com Received: from [74.125.82.50] ([74.125.82.50:36597] helo=mail-wg0-f50.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 3E/03-60242-53B35625 for ; Mon, 21 Oct 2013 10:33:25 -0400 Received: by mail-wg0-f50.google.com with SMTP id n12so6672778wgh.29 for ; Mon, 21 Oct 2013 07:33:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :subject:references:in-reply-to:content-type :content-transfer-encoding; bh=7d7xuw//2d1NUUJaebO4GWN2aRdpZTo5mCVenNzYx0o=; b=PYfVO4VOfn3HFSVW0jQU5L+pBksCwzQjKqv4J0UAbj31yAUlvgwDiml6Mt9jQZU/jp P6BMeLJ3JatXdVC3Eg3cZ3EfEvaj4YGGfihU/W0jGcS8Mw7BzfIDzzvonTf4RHIAihkS BrH9WtD+ID6kVk15SSpoq4JplkxgQ20O+r4pxvJSL3bGKr21NRJp29sfCMufca2YCHCW fh+7BLZy1Heke6SDCP1olHQ3yJHK14ZIV3jawpiS6+j9IncWhLu5jgZB9qmuSXRB1/b0 2DROXcZUZMR4juNlPZ8Ag6wNgdGlbSSY52k0eXVtwrUE2zqgRkDOJFY2L3tFSP69+47U vi+Q== X-Gm-Message-State: ALoCoQkpPw/1WgPYeS4Ym9dEFUCiylKdrJuorYTFl8fbOJjXJKXu8ia0CTQb8H5xsfnXs+R95S5q X-Received: by 10.180.231.6 with SMTP id tc6mr10176207wic.59.1382366002308; Mon, 21 Oct 2013 07:33:22 -0700 (PDT) Received: from [192.168.0.3] (cpc22-asfd3-2-0-cust209.1-2.cable.virginmedia.com. [80.4.21.210]) by mx.google.com with ESMTPSA id ey4sm32979972wic.11.2013.10.21.07.33.21 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 21 Oct 2013 07:33:21 -0700 (PDT) Message-ID: <52653B30.8050906@pthreads.org> Date: Mon, 21 Oct 2013 15:33:20 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130625 Thunderbird/17.0.7 MIME-Version: 1.0 To: Hochstrasser Christoph , internals@lists.php.net References: <3D.BC.23638.84CA1625@pb1.pair.com> <5A140DF2-A29B-4804-A65C-37F6FB28D383@fastmail.fm> In-Reply-To: <5A140DF2-A29B-4804-A65C-37F6FB28D383@fastmail.fm> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] RFC: Expectations From: pthreads@pthreads.org (Joe Watkins) On 10/21/2013 02:27 PM, Hochstrasser Christoph wrote: > Hi Derick, > >> This is again an RFC that does not even attempt to argue for its >> usefulness. "This functionality was meant to replace the assert() API >> that currently exists in PHP, because of problems replacing it in a >> compatible manner". This doesn't say what is wrong with assert() or >> whether we *need* expect. >> > The RFC was first proposed as a RFC to replace the "assert()" function with a "assert" keyword (which produces an opcode) in order to fix the unacceptable performance of the current "assert()" implementation. See also https://wiki.php.net/rfc/expectations#performance > > Later it was renamed to "expect" because the overall opinion was that changing "assert()" can't be done in 5.x. > > Yes, this RFC could state more clearly what its purpose is, but it certainly has usefulness. It's a lot faster than "assert()", when turned off "expect" becomes a NOOP, and it doesn't rely on "eval()". Morning, I'm not so good at conveying ideas; the explanation you have there is a summarized version of the java documentation of the same idea, the implementations are so similar they could be called identical. So everyone has a clear idea of how this works, here's some detail about the op array for the statement "expect false;": Optimizations=On Expectations=On (DEVELOPMENT): opcodes[2] opcodes[0] -> ZEND_EXPCT expression opcodes[1] -> ZEND_RETURN Optimizations=Off Expectations=On: opcodes[9] opcodes[0]-opcodes[6] -> ZEND_NOP opcodes[7] -> ZEND_EXPCT expression opcodes[8] -> ZEND_RETURN Optimizations=On Expectations=Off (PRODUCTION) opcodes[1] opcodes[0] -> ZEND_RETURN Optimizations=Off Expectations=Off: opcodes[8] opcodes[0] -> ZEND_JMP opcodes[7] opcodes[1]-opcodes[6] -> ZEND_NOP opcodes[7] -> ZEND_RETURN The same opcodes for "assert("false")": Optimizations=Either Assertions=Either (LEGACY): opcodes[3] opcodes[0] -> ZEND_SEND_VAL string opcodes[1] -> ZEND_DO_FCALL assert opcodes[2] -> ZEND_RETURN When Assertions=Off opcodes[1] does not result in a call to eval, but the actual call to assert cannot be optimized, dragging down production considerably. Cheers Joe