Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:77058 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 81368 invoked from network); 4 Sep 2014 14:02:30 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Sep 2014 14:02:30 -0000 Authentication-Results: pb1.pair.com smtp.mail=dmitry@zend.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=dmitry@zend.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 209.85.220.180 as permitted sender) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 209.85.220.180 mail-vc0-f180.google.com Received: from [209.85.220.180] ([209.85.220.180:35508] helo=mail-vc0-f180.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id DC/35-53069-5F078045 for ; Thu, 04 Sep 2014 10:02:30 -0400 Received: by mail-vc0-f180.google.com with SMTP id lf12so10722085vcb.11 for ; Thu, 04 Sep 2014 07:02:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=U0iVmSej/etNaq/htDWJsyT43cV7DqkyKiTJCvbGFS4=; b=l/bzjXSHazK4QdiUQAOzLc4yeCz0ABuD2yZU5R/d6AHkAtbacgGk2pPU/uBel57cWO HP35Jz2iqE/FbzBV2Ueo6YmT9jFtV03YdXDoeJn09PDdgzx4Qxy90flZ1Ew6rL2/6dsd y7Sc1nBul1alPgu+9S0WeRCKPB4eb44PsyPO2vL9nJjg8ICmm3tX6Z4iGof041gQVxiJ yxiYpA5Ymbq82DRefArEMQ++sQcUyu7Hji3RuCKdUEVQ+jgx51Nd7zc3ZO371lr90V+B Wg/0PFinDFMiuIV1Cd8selvd8Ayi8Px5bmJdhlLo6vsxe7Djdn9akhe6CZ1b/PE7CT1x GP+g== X-Gm-Message-State: ALoCoQlWVR9EdUinTtHVUkYz9I+QYJa/OqB0GAhNO3zJjYPzGeBm7ipMpr2EkOgTM2FjtFRLFC+tqTHwn+Gv348fN7xXkNQoGhajk9mgz5hJXSZGALwug05N9x/gnQRhIL3hebSDohWeXKIORcTkq/+9Yc9wXYSPCg== MIME-Version: 1.0 X-Received: by 10.220.182.1 with SMTP id ca1mr3994310vcb.21.1409839346583; Thu, 04 Sep 2014 07:02:26 -0700 (PDT) Received: by 10.52.110.170 with HTTP; Thu, 4 Sep 2014 07:02:26 -0700 (PDT) In-Reply-To: References: Date: Thu, 4 Sep 2014 18:02:26 +0400 Message-ID: To: Derick Rethans Cc: Bob Weinand , PHP internals Content-Type: multipart/alternative; boundary=001a1132f2a271a0c105023dcde9 Subject: Re: [PHP-DEV] Fast zend_parse_parameters API From: dmitry@zend.com (Dmitry Stogov) --001a1132f2a271a0c105023dcde9 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Thu, Sep 4, 2014 at 5:32 PM, Derick Rethans wrote: > On Thu, 4 Sep 2014, Bob Weinand wrote: > > > After a long time=E2=80=A6 back to our fast_zpp RFC. > > > > Initially Dmitry proposed to have two different APIs, one for the fast > version, one for current version: > > #if FAST_ZPP > > /* new API */ > > #else > > /* old style zend_parse_parameters API */ > > #endif > > > > I don't really like the idea of having two different APIs, so I'd > > rather propose to use one same public API for both. That API should, > > depending on some compile-time flag (per file or globally in > > zend_API.h), either convert to the usual variadic style function, or > > expand to the new fast variant of API parsing (with directly inlining > > parameter type specific functions). > > I am going to need an ifdef anyway, once for < PHP 7 and once for >=3D PH= P > 7... > > > What do you think about having one unified API for both, instead of > > the current (like it's in some places in master branch currently)? > > (p.s.: The rewrite of the current API can be done safely via some PHP > > script I wrote) > > I think it makes perfect sense to have two styles. Keep the current zpp > that we have, and only optimise it with the much less readable versions > for functions (think strlen()) that are called a lot. > > > Also, there is the question about how to structure the API; we (I and > > Dmitry) basically have now two different proposals: > > > > > > ZEND_PARSE_PARAMETERS_START(3, 5) > > Z_PARAM_ZVAL(regex) > > Z_PARAM_ZVAL(replace) > > Z_PARAM_ZVAL(subject) > > Z_PARAM_OPTIONAL > > Z_PARAM_LONG(limit) > > Z_PARAM_ZVAL_EX(zcount, 0, 1) > > ZEND_PARSE_PARAMETERS_END_EX(return); > > > > OR > > > > zend_parse_parameters(ZPP_ZVAL(regex) ZPP_ZVAL(replace) > ZPP_ZVAL(subject) ZPP_OPTIONAL ZPP_LONG(limit) ZPP_ZVAL_EX(zcount, > ZPP_BY_REF), { > > return; > > }) > > Both of them very much suck as API compared to: > > if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ZZZ|lZ", ®ex, > &replace, &subject, &limit, &zcount) =3D=3D FAILURE) { > scanf() is suck as well, but I agree, that it makes no sense to switch from one bad but working solution to another one. > As I mentioned before, keep the current zpp working, and add a special > one for the functions where a faster one really matters. > This was an original proposal, that is already in php-master, but I promised that we will discuss it in some point. Thanks. Dmitry. > > cheers, > Derick > > -- > http://derickrethans.nl | http://xdebug.org > Like Xdebug? Consider a donation: http://xdebug.org/donate.php > twitter: @derickr and @xdebug > Posted with an email client that doesn't mangle email: alpine --001a1132f2a271a0c105023dcde9--