Array Collapse Performance Improvement in Laravel 5.8.20
Published on by Paul Redmond
The Laravel team released v5.8.20 yesterday with a performance improvement to the Arr::collapse()
method along with the latest weekly additions, changes, and fixes.
Performance Improvements
Last week we saw an improvement to the Arr::flatten()
method in v5.8.19, and this week the Arr
class gets another performance improvement to the collapse
method.
As far as I understand the code, gist of the change is that now array_merge
is called once instead of n
times based on the size of the array. Check out Pull Request #28662 for details on the change and a follow-up Pull Request #28676 that removes the redundant additional empty array introduced in the first PR.
New Features
The viewAny
method was added to the policy class stub used with the index
action of a controller resource.
Next, the --fullpath
option was added to the make:migration
command that will output the full file path of the file. Outputting the full file path to the console is useful in terminals that enable you to open file paths in an editor.
You can see the full list of fixes below, and the whole diff between 5.8.19 and 5.8.20 on GitHub. The full release notes for Laravel 5.8 are available in the GitHub 5.8 changelog:
v5.8.20
Added
- Added
viewAny()
to dummy policy class (#28654, #28671) - Added
fullpath
option tomake:migration
command (#28669)
Performance improvement
Fixed
- Fixed
artisan cache:clear
command with a redis cluster using the Predis library (#28706)