Re: [PHP-DEV] array_merge() vs array unpacking performance

2022-08-01 Thread David Rodrigues
> There are already a number of optimizations in array_merge. It might depend on the actual test data that you used. Maybe a specific path needs to be optimized. Please provide some more details. You are right. I do not know how I tested before, but actually, array_merge() is bit faster than

Re: [PHP-DEV] array_merge() vs array unpacking performance

2022-08-01 Thread Kamil Tekiela
Hi David, It would be useful if you could provide your measurements and the way you arrived at such results. A quick test doesn't seem to support your findings: https://3v4l.org/v5m9f#v8.1.8 There are already a number of optimizations in array_merge. It might depend on the actual test data that

[PHP-DEV] array_merge() vs array unpacking performance

2022-08-01 Thread David Rodrigues
Hello! PHP 8.1 supports array unpacking with keys. I guess that is very similar to array_merge(), but for some reason array_merge() is 50% slower than unpacking. So my question is: is there some way to optimize the engine so array_merge() can work like unpacking? Thanks!