]> git.wh0rd.org Git - tt-rss.git/commitdiff
increase performance of queryFeedHeadlines request
authorAndrew Dolgov <fox@madoka.spb.ru>
Fri, 18 May 2007 04:16:33 +0000 (05:16 +0100)
committerAndrew Dolgov <fox@madoka.spb.ru>
Fri, 18 May 2007 04:16:33 +0000 (05:16 +0100)
backend.php
functions.php

index 9ca9e05363b5d0be1dcc88b3f5cc65233cc3c83e..9b28f650eacb8b47bd143249043d2c30639a6a91 100644 (file)
 
        if ($op == "viewfeed") {
 
+               $print_exec_time = true;
+               $timing_info = getmicrotime();
+
                print "<reply>";
 
+               if ($_GET["debug"]) $timing_info = print_checkpoint("0", $timing_info);
+
                $omode = db_escape_string($_GET["omode"]);
 
                $feed = db_escape_string($_GET["feed"]);
 
                print "]]></headlines>";
 
+               if ($_GET["debug"]) $timing_info = print_checkpoint("10", $timing_info);
+
                if (is_array($topmost_article_ids) && !get_pref($link, 'COMBINED_DISPLAY_MODE')) {
                        print "<articles>";
                        foreach ($topmost_article_ids as $id) {
                        print "</articles>";
                }
 
+               if ($_GET["debug"]) $timing_info = print_checkpoint("20", $timing_info);
+
                print "<counters>";
                getAllCounters($link, $omode);
                print "</counters>";
 
+               if ($_GET["debug"]) $timing_info = print_checkpoint("30", $timing_info);
+
                print "</reply>";
        }
 
index ba8c4e6a6db6c5288494ffd9b7d3d02a5162eed2..ec234ddc252634f2143bd9bc1095595267f654e2 100644 (file)
                                $query = "SELECT 
                                                guid,
                                                ttrss_entries.id,ttrss_entries.title,
-                                               SUBSTRING(updated,1,16) as updated,
+                                               updated,
                                                unread,feed_id,marked,link,last_read,
                                                SUBSTRING(last_read,1,19) as last_read_noms,
                                                $vfeed_query_part
                                $result = db_query($link, "SELECT
                                        guid,
                                        ttrss_entries.id as id,title,
-                                       SUBSTRING(updated,1,16) as updated,
+                                       updated,
                                        unread,feed_id,
                                        marked,link,last_read,                          
                                        SUBSTRING(last_read,1,19) as last_read_noms,
        function outputHeadlinesList($link, $feed, $subop, $view_mode, $limit, $cat_view,
                                        $next_unread_feed, $offset) {
 
+               $timing_info = getmicrotime();
+
                $topmost_article_ids = array();
 
                if (!$offset) $offset = 0;
 
                $real_offset = $offset * $limit;
 
+               if ($_GET["debug"]) $timing_info = print_checkpoint("H0", $timing_info);
+
                $qfh_ret = queryFeedHeadlines($link, $feed, $limit, $view_mode, $cat_view, 
                        $search, $search_mode, $match_on, false, $real_offset);
 
+               if ($_GET["debug"]) $timing_info = print_checkpoint("H1", $timing_info);
+
                $result = $qfh_ret[0];
                $feed_title = $qfh_ret[1];
                $feed_site_url = $qfh_ret[2];
 #                                      $line["title"] . "</a>";
 
                                if (get_pref($link, 'HEADLINES_SMART_DATE')) {
-                                       $updated_fmt = smart_date_time(strtotime($line["updated"]));
+                                       $updated_fmt = smart_date_time(strtotime($line["updated_noms"]));
                                } else {
                                        $short_date = get_pref($link, 'SHORT_DATE_FORMAT');
-                                       $updated_fmt = date($short_date, strtotime($line["updated"]));
+                                       $updated_fmt = date($short_date, strtotime($line["updated_noms"]));
                                }                               
 
                                if (get_pref($link, 'SHOW_CONTENT_PREVIEW')) {
                                $key . '">' . $key . '</a> ';
                }
        }
+
+       function print_checkpoint($n, $s) {
+               $ts = getmicrotime();   
+               echo sprintf("<!-- CP[$n] %.4f seconds -->", $ts - $s);
+               return $ts;
+       }
 ?>