Re: RFC: Add `final class Vector` to PHP
| From: | Max Semenik | Date: | Fri, 17 Sep 2021 19:36:59 +0000 |
| Subject: | Re: RFC: Add `final class Vector` to PHP | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-116077@lists.php.net to get a copy of this message | ||
On Fri, Sep 17, 2021 at 5:10 AM tyson andre <tysonandre775@hotmail.com>
wrote:
> Hi internals,
>
> I've created a new RFC https://wiki.php.net/rfc/vector
> proposing to add
>
final class Vector to PHP.
Thank you so much, Tyson - I love your proposal. Since Ds was mentioned,
I've added it to your benchmark (code and complete results at
https://gist.github.com/MaxSem/d0ea0755d6deabaf88c9ef26039b2f27):
Appending to array: n= 1048576 iterations= 20 memory=33558608
bytes, create+destroy time=0.369 read time = 0.210 result=10995105792000
Appending to Vector: n= 1048576 iterations= 20 memory=16777304
bytes, create+destroy time=0.270 read time = 0.270 result=10995105792000
Appending to SplStack: n= 1048576 iterations= 20 memory=33554584
bytes, create+destroy time=0.893 read time = 0.397 result=10995105792000
Appending to SplFixedArray: n= 1048576 iterations= 20 memory=16777304
bytes, create+destroy time=2.475 read time = 0.340 result=10995105792000
Appending to Ds\Vector: n= 1048576 iterations= 20 memory=24129632
bytes, create+destroy time=0.389 read time = 0.305 result=10995105792000
Another comparison with Ds, I wonder if an interface akin to Ds\Sequence[1]
could be added, to have something in common with other future containers.
-----
[1] http://docs.php.net/manual/en/class.ds-sequence.php
--
Best regards,
Max Semenik