Hah, I sure did not expect my answer to trigger these 5 complex RFCs
worth of work ;)
On 03/06/2021 00:59, Mike Schinkel wrote:
4.) Given Nikita's comments on the O(<n>) performance of array_shift() have you
considered instead simulating a FIFO queue using an array as a stack? Any reason
that would not work for your needs?
I think your analysis is overall on point. There are probably better
data structures that could lead to me not needing array_shift in most
places I use it. However arrays are quite the tool in PHP, and lazy as
it may be they usually do the job well enough and the perf overhead of
reindexing (which tbh I was not aware of until this thread) seems
unnoticeable in most case (a quick test shows 1ms to shift a 300K item
array on my loaded laptop, which is really quite acceptable).
So in summary the tangential topics I addressed were:
1.) PHP potentially supporting multiple return values, and
2.) Renewed focus on SPL data structures.
Again, if anyone is interested in these tangential topics and wants to discuss
further, please create a new thread and quote my applicable comments from this
email.
To your other points: Multiple return values and SPL with better
docs/naming/usability would absolutely be great to have from my userland
perspective.
Best,
Jordi
--
Jordi Boggiano
@seldaek - https://seld.be
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php