On Thu, May 12, 2016 at 7:27 PM, firstname.lastname@example.org wrote:
PHP 7 leverages a lot the performance internally and many PHP applications
in the wild. Much of these improvement came by experimentation through
PHPNG and the usage of efficient data structures internally. This idea of
performance improvements are crucial to handle more requests, reduce server
However, what lacks in PHP is the exposure of more efficient, use case
specific data structures, that could allow end users to easily improve
performance of their applications, instead of using a general,
multi-purpose data structure that we have as "array".
Based on that (please keep in mind I haven't spoken with library author),
I'd like assess the receptability of incorporating php-ds library into core.
Library author wrote a good (and lengthy) article explaining his motivation
and performance benchmarks around it. Here are the related links:
Lead Architect at E-Block
I've actually been working on data structures for PHP for years. I'm
really glad I haven't pushed for anything before PHP 7, as
improvements there give much more control in the data structures which
I can say that work in question is of fairly good quality, though it
makes some design decisions that I disagree with. Notably I think the
Hashable interface is inferior to asking for hash and equal functions.
By forcing the objects to be Hashable or to use spl_object_hash you
cannot put objects into Maps or Sets that do not implement the
interface (if you need behavior other than spl_object_hash). Routinely
this has been a problem of every collection style library I've used
before: having to implement a given interface that is new means the
majority of the objects you want to put into it do not implement the
Also, if we move forward with putting this into core then we need to
solidify our namespace. We currently reserve `PHP` and `php` in the
docs, but this is not enforced in the runtime. I would not want to put
these structures into the global namespace because `Map`, `Set` and
`Collection` are all very common names.
In any case I encourage people to use the APIs if they are somewhat
interested. There is a polyfill available so you can become familiar
without installing the extension.