From 0f94402b7e8b7e25ee605f830b7c7becbe78ba8b Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sat, 29 Feb 2020 18:19:09 +0100 Subject: Better performance with yield (#2588) * Better performance with yield Largely decrease the time to first byte, and reduced memory consumtion. Before, we used to make several copies in memory of the whole list of articles before sending them to the client. Now streamed as they are processed. * Travis --- p/api/greader.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'p/api') diff --git a/p/api/greader.php b/p/api/greader.php index c63ed12fa..6da11ec5f 100644 --- a/p/api/greader.php +++ b/p/api/greader.php @@ -638,6 +638,7 @@ function streamContents($path, $include_target, $start_time, $stop_time, $count, $entryDAO = FreshRSS_Factory::createEntryDao(); $entries = $entryDAO->listWhere($type, $include_target, $state, $order === 'o' ? 'ASC' : 'DESC', $count, $continuation, $searches); + $entries = iterator_to_array($entries); //TODO: Improve $items = entriesToArray($entries); @@ -730,6 +731,7 @@ function streamContentsItems($e_ids, $order) { $entryDAO = FreshRSS_Factory::createEntryDao(); $entries = $entryDAO->listByIds($e_ids, $order === 'o' ? 'ASC' : 'DESC'); + $entries = iterator_to_array($entries); //TODO: Improve $items = entriesToArray($entries); -- cgit v1.2.3