php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #75533 array_reduce is slow when $carry is large array
Submitted: 2017-11-16 04:31 UTC Modified: -
Votes:3
Avg. Score:3.3 ± 0.5
Reproduced:1 of 2 (50.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: manabu dot matsui at gmail dot com Assigned:
Status: Closed Package: Performance problem
PHP Version: 7.1.11 OS: macOS 10.13.1
Private report: No CVE-ID: None
 [2017-11-16 04:31 UTC] manabu dot matsui at gmail dot com
Description:
------------
array_reduce is slow when $carry is very large array and return it with some modification.

My test script is test_array_reduce.php at https://gist.github.com/crhg/45c1f73ca59c9b0f6274412019b19fca

I replaced array_reduce with simple pure php implementation, it runs fast.
Script of this case is test_my_reduce.php.



Patches

Pull Requests

Pull requests:

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-09-17 13:46 UTC] martin dot ninov at gmail dot com
This still exists in php 7.2.9.

It's been almost a year, and there's even a PR, can we get a move on with the fix?
 [2018-09-18 05:40 UTC] manabu dot matsui at gmail dot com
Since PR #2931 conflicted with changes to fix #76778, I updated it.
 [2018-09-18 18:52 UTC] nikic@php.net
Automatic comment on behalf of manabu.matsui@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=ab6c45f5249d077463c1876d7cf09a11f04240fa
Log: Fix bug #75533: array_reduce is slow when $carry is large array
 [2018-09-18 18:52 UTC] nikic@php.net
-Status: Open +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 16:01:28 2024 UTC