Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:94145 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 7450 invoked from network); 20 Jun 2016 07:12:48 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Jun 2016 07:12:48 -0000 Authentication-Results: pb1.pair.com header.from=dmitry@zend.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=dmitry@zend.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 65.55.169.127 as permitted sender) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 65.55.169.127 mail-bl2on0127.outbound.protection.outlook.com Received: from [65.55.169.127] ([65.55.169.127:49948] helo=na01-bl2-obe.outbound.protection.outlook.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 56/12-25084-D6797675 for ; Mon, 20 Jun 2016 03:12:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=RWSoftware.onmicrosoft.com; s=selector1-zend-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=bN9/CUGyNzY7pV3QBdk1ch2iXrcCB/x3kwqqu7V4ZUQ=; b=QTYKBNKcWmhk3BL2uDzRTOanqN5EFdXRiu45ZMKdXpez8199YaFfaj/TSQaZ+qgDW9nx8N62PNHI6HMw/ABNkFOKT+2YE7vB7bu4MKdmeaIF0jkzvQEX3eLhlrAWSUT+O69V5ZwKbImyEIosQTrAp2nUBg57oEJXwFCnjNOACW0= Received: from BY2PR0201MB1784.namprd02.prod.outlook.com (10.163.72.26) by BY2PR0201MB1782.namprd02.prod.outlook.com (10.163.72.24) with Microsoft SMTP Server (TLS) id 15.1.523.12; Mon, 20 Jun 2016 07:12:36 +0000 Received: from BY2PR0201MB1784.namprd02.prod.outlook.com ([10.163.72.26]) by BY2PR0201MB1784.namprd02.prod.outlook.com ([10.163.72.26]) with mapi id 15.01.0523.015; Mon, 20 Jun 2016 07:12:36 +0000 To: Aaron Piotrowski , Dan Ackroyd CC: "internals@lists.php.net" Thread-Topic: [PHP-DEV] [RFC] Iterable Thread-Index: AQHRyXcEYsKFn/7XVUmGbphMRFgZVJ/v2nYAgAEj4gCAAPQQNA== Date: Mon, 20 Jun 2016 07:12:35 +0000 Message-ID: References: <8284FE1F-70EE-4DB6-A945-0C57A4C99DCC@trowski.com> <16ef864f-8378-1af3-ddfb-21dc583a4b4a@gmx.de> <35132CB5-6E11-477F-8AC6-4374A7434D43@trowski.com> ,<549528A0-E6D0-4413-B8C3-CD3C37685E53@trowski.com> In-Reply-To: <549528A0-E6D0-4413-B8C3-CD3C37685E53@trowski.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=dmitry@zend.com; x-originating-ip: [132.245.81.165] x-ms-office365-filtering-correlation-id: ec95629e-6db3-44e7-9594-08d398da41ea x-microsoft-exchange-diagnostics: 1;BY2PR0201MB1782;6:BBi/pOX46aqfeI7gPTCQkNfL5tbHv0woZKj7s8yuzazUOyEvtgyHqFl0EgS9A/zREywcYPCcHEtSSrg/uuZ4aiUHwB2kjFXWHVc2mY0qddH3eGIU8FUnanslZPXRZVYUaEhEQGYxKmwEHEDNN+pnstE7yKFj5vJXK2a1l5ezRkcn5e9cT9rjrEfLrvyioG9onpb9oYB9BPpA2bA0oqRh1El2NqslV1yGM9FJx6GOnC0Dq+vGWhFyHpoBLtjehLxZxTGuRL79JlezpyAFdXMhisjdUk1EkbnFcoCsM0oc++k=;5:4Feoyw12bsQuSmXw3iHPOgPsslspiGd4Sc3rm1y9Nkqg8qNuKXCsiKTlsC3FQPt3uX5OW1Gw41M89EJLCnUgv1iBhd/M289IQ/g8hupJ7Bszh8sMD9yDhOWTmQg1MKAYl8GWN5ITwPxH0ipCcV+/rQ==;24:5O22ABLdgkNJNMqaHIpk12r2KAvj7JlspOkINZ7PwDT7vLGbr51bOewNdXdatdnXndks8t4W2aZ2sDzKpuvG4C6YXg2UbBDpAivooZundX4=;7:oIFAxfQRnRRtmIsjfTG3SLxonozTXYQ3TgN0GQEePHEHmvzvt6bpwC2PcKoWanLnJ5MH6S9uWgBqlNmYN9nicA9f+oY9nsOebnFyZcYNMtMuhYZtEDiW6V2PVml20bXoPOOJtLB/uGgTYs8YITyquUXXqvC5HxOVRMjeVfrN8vkWcSiCiJLycJMxffubg8A1lwbW90+YMU+v7bPxD17zEI+ZkE86JHzGyXOb9Av5xKe9cMfCjr+poJKuFeoNR1z6 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY2PR0201MB1782; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(158342451672863)(166708455590820)(192278398808882); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001);SRVR:BY2PR0201MB1782;BCL:0;PCL:0;RULEID:;SRVR:BY2PR0201MB1782; x-forefront-prvs: 09796A1B83 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(7916002)(377454003)(189002)(24454002)(199003)(8676002)(10400500002)(81166006)(81156014)(5002640100001)(87936001)(561944003)(122556002)(86362001)(93886004)(66066001)(5004730100002)(92566002)(11100500001)(2900100001)(15975445007)(2950100001)(189998001)(5003600100002)(33656002)(575784001)(77096005)(16236675004)(76576001)(19580395003)(8936002)(6116002)(102836003)(106356001)(19617315012)(9686002)(68736007)(4326007)(50986999)(54356999)(76176999)(74316001)(3660700001)(97736004)(99286002)(586003)(2906002)(19625215002)(5001770100001)(7906002)(101416001)(106116001)(3846002)(105586002)(3280700002)(7846002)(19580405001);DIR:OUT;SFP:1102;SCL:1;SRVR:BY2PR0201MB1782;H:BY2PR0201MB1784.namprd02.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; received-spf: None (protection.outlook.com: zend.com does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: multipart/alternative; boundary="_000_BY2PR0201MB1784173632E772A501A53F0ABF2A0BY2PR0201MB1784_" MIME-Version: 1.0 X-OriginatorOrg: zend.com X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Jun 2016 07:12:35.7579 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 32210298-c08b-4829-8097-6b12c025a892 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR0201MB1782 Subject: Re: [PHP-DEV] [RFC] Iterable From: dmitry@zend.com (Dmitry Stogov) --_000_BY2PR0201MB1784173632E772A501A53F0ABF2A0BY2PR0201MB1784_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable From the first look, the patch shouldn't make any visible effect on perform= ance. According to the proposed new pseudo type - I don't have any strong opinion= . Thanks. Dmitry. ________________________________ From: Aaron Piotrowski Sent: Sunday, June 19, 2016 7:35:50 PM To: Dan Ackroyd Cc: internals@lists.php.net; Dmitry Stogov Subject: Re: [PHP-DEV] [RFC] Iterable > On Jun 18, 2016, at 6:11 PM, Dan Ackroyd wrote: > > Hi Aaron, > >> does anyone have any further feedback on this proposal? > > What is the performance impact of the RFC on the standard performance > benchmarks? > > And can you comment on the performance of using iterable as a type for > parameters/return types, compared to normal classes? > > cheers > Dan Hi Dan, Great questions! This RFC has litte to no impact to the standard performance benchmarks. The= se benchmarks do not have functions with type declarations, so they are lar= gely unaffected by an of the code changed by this RFC. The largest impact is to functions with scalar parameter or return type dec= larations. An extra integer comparison is performed during the compilation = step to check if the type declaration equals IS_ITERABLE. [1] for parameter= and [2] for return types. If a parameter is not a class name and has a def= ault argument, another integer compare is performed [3]. The patch also performs an additional integer compare to IS_ITERABLE when a= type not directly matching the type declaration is provided and the type d= eclaration is a scalar type. This applies to both parameter [4] and return = type declarations [5]. User code using `iterable` would only be slightly slower than using `array`= or `Traversable`, as a few extra integer comparisons are made and addition= al function call is made to verify the type matches one of the two allowed = types (see [4] and [5] again). However, the flexibility provided by `iterab= le` is well worth this very small penalty. For comparison, this overhead is= far less than the `callable` pseudo-type as the value is not examined, onl= y the type. In my tests against type declarations using other interfaces such as `Itera= tor` or `IteratorAggregate`, using `iterable` was about equal in performanc= e. [6] Overall in my opinion, the performance impact of this RFC is negligible. Dmitry, could you take a look at the patch and do some of your own performa= nce checks? Thanks! Aaron Piotrowski [1] https://github.com/php/php-src/pull/1941/files#diff-9760ee109b1c5922071= fac1e19d117dfR332 [2] https://github.com/php/php-src/pull/1941/files#diff-9760ee109b1c5922071= fac1e19d117dfR360 [3] https://github.com/php/php-src/pull/1941/files#diff-3a8139128d4026ce0cb= 0c86beba4e6b9R5082 [4] https://github.com/php/php-src/pull/1941/files#diff-a5fb5fd8c4f7311c6d0= 788763e665daaR857 [5] https://github.com/php/php-src/pull/1941/files#diff-a5fb5fd8c4f7311c6d0= 788763e665daaR1080 [6] https://gist.github.com/trowski/6f4b8b689228c7ba930fa658bb3c87f9 --_000_BY2PR0201MB1784173632E772A501A53F0ABF2A0BY2PR0201MB1784_--