From 463d07824e66273d6233f0f8fac8095aed32c28e Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Sun, 10 Apr 2016 04:41:51 -0400
Subject: [PATCH] Merge pull request #5194 from bostjan/optimization/make-thread-listing-faster

---
 program/lib/Roundcube/rcube_result_thread.php |   18 +++---------------
 1 files changed, 3 insertions(+), 15 deletions(-)

diff --git a/program/lib/Roundcube/rcube_result_thread.php b/program/lib/Roundcube/rcube_result_thread.php
index c508a66..b80e38b 100644
--- a/program/lib/Roundcube/rcube_result_thread.php
+++ b/program/lib/Roundcube/rcube_result_thread.php
@@ -242,22 +242,10 @@
             return;
         }
 
+        $raw_data_reverse = implode(self::SEPARATOR_ELEMENT, array_reverse(explode(self::SEPARATOR_ELEMENT, $this->raw_data)));
+        $this->raw_data = $raw_data_reverse;
+
         $this->meta['pos'] = array();
-        $datalen = strlen($this->raw_data);
-        $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->raw_data = rtrim($result, self::SEPARATOR_ELEMENT);
     }
 
     /**

--
Gitblit v1.9.1