Re: Publishing a new PHP extension to PECL

From: Date: Mon, 10 Sep 2018 15:24:56 +0000
Subject: Re: Publishing a new PHP extension to PECL
References: 1 2  Groups: php.pecl.dev 
Request: Send a blank email to pecl-dev+get-15470@lists.php.net to get a copy of this message
Thanks for your reply. 1. While this extension looks similar to the DS extension, there are several notable differences: * The DS extension implements its own data structures, while this extension uses just zend_array. It's much cheaper when you're "converting" a PHP array into a Collection, and vice versa. It just increments the refcount, without having to iterate through the array and copy its elements. * This extension has much more methods(mostly ported from kotlin.collections) than the DS extension, which can minimize userland business logic operating the array. 2. See this [gist](https://gist.github.com/CismonX/0bfa2bd6f2b257e5d4a49afa635819fe) for some simple performance comparison. * If the userland implementation is doing the same thing as the extension(also uses callbacks), the performance increase is satisfactory. For associate(), it provides a 19% speed boost. * However, if you're not using callbacks, the userland implementation can be faster. That doesn't mean functions like array_map(), array_filter() are useless, though. * In some cases, there's no way to implement some functionalities cheaply in userland PHP, such as sortBy(). It provides a 500% speed boost in comparison with the usort() workaround. 3. Good suggestion. I'll have the Collection class implement the Iterator interface. ------------------ Original ------------------ From: "Arnold Daniels"<arnold@jasny.net>; Date: Mon, Sep 10, 2018 06:13 PM To: "CismonX"<admin@cismon.net>; Cc: "pecl-dev"<pecl-dev@lists.php.net>; Subject: Re: [PECL-DEV] Publishing a new PHP extension to PECL Some critique, sorry... * This seems comparable to the DS extension; http://php.net/ds. Why not discuss and/or collaborate? I feel having too many similar extensions is not good.* I wonder how much this will perform than a userspace implementation for most methods, as they use callbacks. * For cases where it's not required to have ArrayAccess, but just traverse through the items, it would be preferable if the Collection is just iterable (functions similar to a Generator), so the methods form a pipeline. - Arnold On Sat, Sep 8, 2018 at 3:14 PM CismonX <admin@cismon.net> wrote: Hello, I'm a student in Tianjin University and a part-time web developer. I'd like to publish one of my extension to PECL, so that it can help more people in their projects. https://github.com/CismonX/ext-collections This extension can serve as a faster, more scalable and object-oriented alternative of ext/standard/array.c, which supports all versions of PHP(ZTS/NTS) starting from 7.1 on any platform. See README.md for details. Now this extension is fully implemented and well-tested, and is not far from going production. I believe now is the time to publish it to PECL. Looking forward to your response! CismonX 9/8/2018 -- PECL development discussion Mailing List (http://pecl.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.pecl.dev (#15470) next »