From f855dbdca6e95ac367b7a9dae9d3a866e1f85d37 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Mon, 2 Sep 2013 22:06:51 +0200 Subject: SQL and model optimisation Big effect (on speed and memory), but few changes :-) Drastically reduced the number of SQL requests needed (from 233 down to 8 to load the home page with my own data set = 140 feeds in 15 categories). Drastically reduced the amount of data transferred from MySQL to PHP. --- app/models/EntriesGetter.php | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'app/models/EntriesGetter.php') diff --git a/app/models/EntriesGetter.php b/app/models/EntriesGetter.php index ca92804a7..dc7ecca7c 100644 --- a/app/models/EntriesGetter.php +++ b/app/models/EntriesGetter.php @@ -94,41 +94,51 @@ class EntriesGetter { public function execute () { $entryDAO = new EntryDAO (); - HelperEntry::$nb = $this->nb; - HelperEntry::$first = $this->first; + HelperEntry::$nb = $this->nb; //TODO: Update: Now done in SQL + HelperEntry::$first = $this->first; //TODO: Update: Now done in SQL HelperEntry::$filter = $this->filter; switch ($this->type['type']) { case 'all': list ($this->entries, $this->next) = $entryDAO->listEntries ( $this->state, - $this->order + $this->order, + $this->first, + $this->nb ); break; case 'favoris': list ($this->entries, $this->next) = $entryDAO->listFavorites ( $this->state, - $this->order + $this->order, + $this->first, + $this->nb ); break; case 'public': list ($this->entries, $this->next) = $entryDAO->listPublic ( $this->state, - $this->order + $this->order, + $this->first, + $this->nb ); break; case 'c': list ($this->entries, $this->next) = $entryDAO->listByCategory ( $this->type['id'], $this->state, - $this->order + $this->order, + $this->first, + $this->nb ); break; case 'f': list ($this->entries, $this->next) = $entryDAO->listByFeed ( $this->type['id'], $this->state, - $this->order + $this->order, + $this->first, + $this->nb ); break; default: -- cgit v1.2.3