laravel-pug
laravel-pug copied to clipboard
Refactor array_map and array_filter
This Pull Request introduces a refactoring of the getPugEngine
method within the ServiceProvider
. The primary objectives are to simplify the logic for enhanced readability and to improve overall performance.
array_map
and array_filter
was slow in the past (when they were actually PHP-coded functions), but have been rewritten in C and since they are actually faster than loops (and creating intermediate variables) in many situations (https://medium.com/@visheshahuja/php-array-map-vs-foreach-loop-18488c95aa18)
So unless some benchmark using recent PHP version, I wouldn't bet performance is a win here.
Also codes before and after here are not equivalent, it might break some untested cases, the readability improvement does not sound worthy to me as a first sight.