Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:120475 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 78272 invoked from network); 30 May 2023 17:42:28 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 30 May 2023 17:42:28 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id C65F4180555 for ; Tue, 30 May 2023 10:42:27 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-ed1-f43.google.com (mail-ed1-f43.google.com [209.85.208.43]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 30 May 2023 10:42:27 -0700 (PDT) Received: by mail-ed1-f43.google.com with SMTP id 4fb4d7f45d1cf-5147f5efeb5so7961664a12.0 for ; Tue, 30 May 2023 10:42:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685468546; x=1688060546; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:from:to:cc:subject:date:message-id:reply-to; bh=mxApuJ5MvVCEcxgfzFt1NbsyHq/68RF1Lh4ZeKQU5RY=; b=bmnrUFhhKUV2fzGBfwFBTd+RtwxJzXAwZEC0v8tj4Q88Zq75C9r4YDzleh32OQpMs5 ORvvizLP7v2bREE9+W9uy111+3Rj9+w3Jy18tO16GwEzij7ZNNhk3dWc4PxD8c8LsfXG eTIjUsITc0Fxaug/Jto22ex50byCh4ugsUZeH3FIF3MZIiM+R4sDgs9fMbIQVDskzhUw k7q2N2EgDBQ8fyxJGBuKfgauNrGM+HaWWpCABJODVkzrDTwiDzUbu36oUqg5nSF6qaQg EP409B/NQq3TPrHsOck+YIpPU1ukGvGSGhwhASvh84S4jB1NQEIVzM8F9EVvL/dqxDHL gVZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685468546; x=1688060546; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=mxApuJ5MvVCEcxgfzFt1NbsyHq/68RF1Lh4ZeKQU5RY=; b=CuWTevk1SIRWSibe6EwKwPiaBaj89O2KdZVoS7HoiaJrjuF9xt4PWvRLkNfZizWDA7 NsuI1AuUp/scpmUQOTFkgTDlu9wpaeciqTcLPpQctyUUqZ3wCvD0rhgsb4f7qLaStm5W 53twMcmdz4WRjZAxFKMu4zf0UdgBpsW41A7OGrerkUAOavkBtEGUjt49p0eLI8sfnEWL MUw0vZUT0uQkZyZTbZMe3W1SNw1d6O33qDbiD6MMRo2ezJNi02BnEFlw/aBlTSUScy/1 FjUoTG+Rq/dJqKmqaz508v8iMWtJ/heuhzKu6DzaOkn7hO2tv5LBTz5k1UXY82Wvqs2A VUUA== X-Gm-Message-State: AC+VfDwznXQfmjp0WF7u8/Eh91araowqDMaPcBvzosk+GtTs5SLUovOK +B7K/hINKAVNb+74b92wLzrXSZYdA30= X-Google-Smtp-Source: ACHHUZ4xnF4+3tHqZmPEsr6ijyBVSF00ygLFlVWoL19UN38sDRCVv2SMY8cKWVO9qgvi6jFDQZffjg== X-Received: by 2002:a17:907:3f90:b0:96f:7070:3419 with SMTP id hr16-20020a1709073f9000b0096f70703419mr3236109ejc.51.1685468545812; Tue, 30 May 2023 10:42:25 -0700 (PDT) Received: from smtpclient.apple ([46.217.211.121]) by smtp.gmail.com with ESMTPSA id i13-20020a17090685cd00b0096f83b16ab1sm7629629ejy.136.2023.05.30.10.42.24 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 May 2023 10:42:25 -0700 (PDT) Message-ID: <92AF3C3F-3B08-4842-986A-3C7AC9EB7A89@gmail.com> Content-Type: multipart/alternative; boundary="Apple-Mail=_0E9D7040-7577-49A1-900D-FE3D1E7C116D" Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.600.7\)) Date: Tue, 30 May 2023 19:42:14 +0200 In-Reply-To: Cc: php internals To: Larry Garfield References: <289E585B-EF8B-4B17-89BE-BE8295FD9FE1@gmail.com> <4CA1668E-A342-452E-A994-5839C377CB27@gmail.com> X-Mailer: Apple Mail (2.3731.600.7) Subject: Re: [PHP-DEV] [RFC] [Discussion] Add new function `array_group` From: buritomath@gmail.com (Boro Sitnikovski) --Apple-Mail=_0E9D7040-7577-49A1-900D-FE3D1E7C116D Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii > On 30.5.2023, at 19:21, Larry Garfield wrote: >=20 > On Tue, May 30, 2023, at 4:27 PM, Boro Sitnikovski wrote: >> Hi, >>=20 >> Thank you for your thoughts. >>=20 >>> I would say the more common desired behavior is the one in your = first >>> example. And even for that we don't have a native function. >>=20 >> This Google search might give more insight into the number of=20 >> discussions about a grouping functionality:=20 >> = https://www.google.com/search?q=3Dphp+group+elements+site:stackoverflow.co= m >>=20 >>> Your behavior can be implemented in userland like so: >>> https://3v4l.org/epvHm >>=20 >> Correct, but then again, we can also implement=20 >> `array_map`/`array_filter`/etc. in userland :) >>=20 >>> I think you need to make a case as to why the behavior you describe >>> justifies a native function. >>=20 >> Similar to my previous answer, but also in general - ease of access = and=20 >> also performance. >=20 > Do you have benchmarks showing that implementing it in C would be = notably faster? That would help the case that it should be written in = C. >=20 > Also, please do not top-post. >=20 > --Larry Garfield >=20 > --=20 > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: https://www.php.net/unsub.php Sorry for the top-posting, my bad. I ran some performance benchmarks and the improvement is about 25% - = some details on the following gist: = https://gist.github.com/bor0/3fa539263335fa415faa67606a469f2e?permalink_co= mment_id=3D4584327#gistcomment-4584327= --Apple-Mail=_0E9D7040-7577-49A1-900D-FE3D1E7C116D--