Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:74510 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 73018 invoked from network); 27 May 2014 02:35:48 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 27 May 2014 02:35:48 -0000 Authentication-Results: pb1.pair.com header.from=laruence@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=laruence@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.220.176 as permitted sender) X-PHP-List-Original-Sender: laruence@gmail.com X-Host-Fingerprint: 209.85.220.176 mail-vc0-f176.google.com Received: from [209.85.220.176] ([209.85.220.176:47447] helo=mail-vc0-f176.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 52/21-00171-DF9F3835 for ; Mon, 26 May 2014 22:35:42 -0400 Received: by mail-vc0-f176.google.com with SMTP id id10so6441377vcb.7 for ; Mon, 26 May 2014 19:35:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=iTB9K6Yg+7d14e5ep7DdeRBV32riAmIUMY42kJwulEc=; b=CBPWHzTcVPmJnytar7AmZR95FlA0TVqQ1RQ4NjyIK7E/vA/p2+nAtfwB2dzB0w95Bp ddDK7/WtzTUDDbsdPB4NUGLLQQhOz/iPJrP2A0odMftMHwiY0EXfGLoHab7zUomZWufV EckOYKYpVo/dGzbeLiBwl/jwwTRt01f9DHbZBCg8LWr+VnfJcDiNTYMb4TATKIaJ+cTn DpTKHFj2Yjcvda6/XkmO5tNfXrziR28GSQfEw9STdWoB1PqnStC4lHd1EifupoY8bfQA W791gUWarwNN9XfYPJvwI7pIDNk02B7M2iWoawMMy7zsaf7VR4Aeat/8yZRd3Q0Q6Mu5 9oJw== X-Received: by 10.220.249.198 with SMTP id ml6mr10589965vcb.36.1401158138944; Mon, 26 May 2014 19:35:38 -0700 (PDT) MIME-Version: 1.0 Sender: laruence@gmail.com Received: by 10.58.218.71 with HTTP; Mon, 26 May 2014 19:35:18 -0700 (PDT) In-Reply-To: <5383F329.3050106@sugarcrm.com> References: <-6285448086228171932@unknownmsgid> <67d97efff27b61e45ef74d4f4339b4b3@mail.gmail.com> <962B3020-200F-45D2-8FEC-AD7A0BFDA50E@ajf.me> <5383F329.3050106@sugarcrm.com> Date: Tue, 27 May 2014 10:35:18 +0800 X-Google-Sender-Auth: pJThROppkoMiu8QnxR01nlVClr0 Message-ID: To: Stas Malyshev Cc: Pierre Joye , Bob Weinand , Andrea Faulds , Dmitry Stogov , Zeev Suraski , PHP Internals , Andi Gutmans , Nikita Popov Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] RE: [RFC] Fast Parameter Parsing API From: xinchen.h@zend.com (Xinchen Hui) Hey: Sorry for top post, first. I am going to talk about a thought I have.. we can reuse the arginfo as the only key struct for function arguments declaration/parsing.. something like, take strlen as example: declaring: ZEND_ARG_INFO(strlen_arginfo, 0, 0, 1) Z_ARG_STR() ZEND_ARG_INFO_END(); then when doing register internal function. Zend vm will bind the Z_ARG_STR to int num_args = 0; (zend_internl_functions *)(strlen_function)->argument_handlers[num_args++] = zend_parse_parameter_str; the zend_parse_parameter_str here is the handler only handling with str(which will be effective) then while in zif_strlen(), only needs call : zend_string *str; zend_parser_parameters(stren_arginfo, &str); the only thing I am not sure now is, if there are more than 1 arguments of one function, let's say it's 5.. this implementation will doing 5 functions call..... which maybe slower than previous zend_parse_parameter thoughts? thanks On Tue, May 27, 2014 at 10:06 AM, Stas Malyshev wrote: > Hi! > >> zpp current usage is much more readable to me and less error prone >> while writing (clang plugin helping to check the syntax, see Johannes >> tools). > > Not really - I have to go to the docs each time to remember what \ or / > are and what is the difference between H and h or z and Z. And putting a > wrong arg type is extremely easy. I've just learned about clang thing > this month, so I'm pretty sure I can count number of people who use it > on one hand, and it doesn't seem to be mentioned anywhere in the docs. > >> May I point you to my questions in this thread about extending the >> reflection struct, add the necessary info (types) and maybe do the >> naming args while being at it? > > This would be great (again, laying ground for named args support) but > I'm not sure how to do it. We have a bit of a contradiction here since > the speedup requires unrolled code (that's what the current ideas do) > and reflection requires static data struct. I'm not sure how to make > both work. Maybe with some kind of function pointers in the data struct > for parsing? But I'm afraid then it would lose the speedup, since it > won't be inlined unrolled code anymore. > -- > Stanislav Malyshev, Software Architect > SugarCRM: http://www.sugarcrm.com/ > (408)454-6900 ext. 227 -- Xinchen Hui Laruence Consultant at Zend http://www.laruence.com/