[Tickets #14075] Re: Large mailboxes takes many seconds to load and causes CPU at 100%
noreply at bugs.horde.org
noreply at bugs.horde.org
Tue Aug 4 20:41:20 UTC 2015
DO NOT REPLY TO THIS MESSAGE. THIS EMAIL ADDRESS IS NOT MONITORED.
Ticket URL: https://bugs.horde.org/ticket/14075
------------------------------------------------------------------------------
Ticket | 14075
Updated By | jose.assis at sipam.gov.br <jose.assis at sipam.gov.br>
Summary | Large mailboxes takes many seconds to load and causes
| CPU at 100%
Queue | Horde Framework Packages
Type | Bug
State | Unconfirmed
Priority | 3. High
Milestone |
Patch | 1
Owners |
------------------------------------------------------------------------------
cunha17 at gmail.com (2015-08-03 23:28) wrote:
The library in question is Horde_Imap_Client.
The class where the performance problem reside is
Horde_Imap_Client_Data_Thread.
And the method causing the high CPU usage is _getAllIndices().
This method uses a simple iteration through _thead array (in my case
having 8088 elements) and merges the keys of each sub-array with the
previous one. So it calls array_merge and array_keys 8088 times:
protected function _getAllIndices()
{
$out = array();
reset($this->_thread);
while (list(,$v) = each($this->_thread)) {
$out = array_merge($out, array_keys($v));
}
return $out;
}
I replaced this iteration with this and the performance issue were gone:
protected function _getAllIndices()
{
return array_keys(call_user_func_array('array_replace',
$this->_thread));
}
Hope it helps and best regards,
Cristiano da Cunha Duarte
More information about the bugs
mailing list