Merge pull request #5194 from bostjan/optimization/make-thread-listing-faster

Make rcube_result_thread::revert() faster
pull/5198/head
Aleksander Machniak 9 years ago
commit 463d07824e

@ -242,22 +242,10 @@ class rcube_result_thread
return; return;
} }
$this->meta['pos'] = array(); $raw_data_reverse = implode(self::SEPARATOR_ELEMENT, array_reverse(explode(self::SEPARATOR_ELEMENT, $this->raw_data)));
$datalen = strlen($this->raw_data); $this->raw_data = $raw_data_reverse;
$result = '';
$start = 0;
while (($pos = @strpos($this->raw_data, self::SEPARATOR_ELEMENT, $start))
|| ($start < $datalen && ($pos = $datalen))
) {
$len = $pos - $start;
$elem = substr($this->raw_data, $start, $len);
$start = $pos + 1;
$result = $elem . self::SEPARATOR_ELEMENT . $result; $this->meta['pos'] = array();
}
$this->raw_data = rtrim($result, self::SEPARATOR_ELEMENT);
} }
/** /**

Loading…
Cancel
Save