-
Notifications
You must be signed in to change notification settings - Fork 11k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[5.8] Arr::flatten performance #28614
Conversation
That's some impressive performance increases. For my own curiosity, and to help Taylor when he comes to review this PR, are you able to explain what the change actually is? i.e. we can see the code that has been changed, but what is the "logic" that allowed you to release there was such a performance improvement here. And how do you know this gives the same result in all situations etc etc. |
@laurencei I was comparing the Performance: |
Nice, thanks! |
Very nice improvements, thanks @bbsnly
Can confirm, in my experience the 2nd worst bottleneck (1st being the database 😉) I've seen in practice (and: being easily identifiable) is this function. If used in a loop and large datasets, almost always a recipe to avoid. |
Nice one! I would have preferred array_push($result, ...$values) instead of a foreach loop but the performance are almost the same between the 2 solutions https://3v4l.org/AH1ZX |
wow, that's a neat trick! I wonder if there are downsides or limitations of argument unpacking a large set for a function call? |
Yeah but that already requires a conclusion if there is an issue with bigger sets. Is there ? ;) |
@solofeed why the mention? |
Sry) It was a mistake) |
MacBook Pro (2017), i5, 16 GB
Before: 1.92s
After: 6.5ms
Before: 6.33s
After: 87ms
Before: 5.7s
After: 88.93ms