From 7bdbb8331c8341e6c3ea0b463f0a742d06972245 Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 25 Jul 2012 22:55:43 -0700 Subject: picking up the page load times a bit --- mod/network.php | 15 +++++++++++++-- mod/ping.php | 24 +++++++++++++++++++++++- 2 files changed, 36 insertions(+), 3 deletions(-) (limited to 'mod') diff --git a/mod/network.php b/mod/network.php index 2f93dd3bc..4ab0c790b 100644 --- a/mod/network.php +++ b/mod/network.php @@ -602,6 +602,8 @@ function network_content(&$a, $update = 0, $load = false) { if($load) $simple_update = ''; + $start = dba_timer(); + if($nouveau && $load) { // "New Item View" - show all items unthreaded in reverse created date order @@ -625,7 +627,7 @@ function network_content(&$a, $update = 0, $load = false) { $items = fetch_post_tags($items); } elseif($load) { -logger('loading:'); + // Normal conversation view @@ -696,7 +698,7 @@ logger('loading:'); } } -logger('items: ' . count($items)); +// logger('items: ' . count($items)); // We aren't going to try and figure out at the item, group, and page // level which items you've seen and which you haven't. If you're looking @@ -714,11 +716,20 @@ logger('items: ' . count($items)); $mode = (($nouveau) ? 'network-new' : 'network'); + $first = dba_timer(); + $o .= conversation($a,$items,$mode,$update,'client'); + + $second = dba_timer(); + if(! $update) { $o .= alt_pager($a,count($items)); } +// logger('parent dba_timer: ' . sprintf('%01.4f',$first - $start)); +// logger('child dba_timer: ' . sprintf('%01.4f',$second - $first)); + + return $o; } diff --git a/mod/ping.php b/mod/ping.php index da9de09b6..05bfe7842 100644 --- a/mod/ping.php +++ b/mod/ping.php @@ -17,6 +17,7 @@ function ping_init(&$a) { $result['notice'] = array(); $result['info'] = array(); + $t0 = dba_timer(); header("content-type: application/json"); @@ -89,6 +90,9 @@ function ping_init(&$a) { if($t) $result['notify'] = intval($t[0]['total']); + + $t1 = dba_timer(); + $r = q("SELECT `item`.`id`,`item`.`parent`, `item`.`verb`, `item`.`wall`, `item`.`author-name`, `item`.`author-link`, `item`.`author-avatar`, `item`.`created`, `item`.`object`, `pitem`.`author-name` as `pname`, `pitem`.`author-link` as `plink` @@ -108,12 +112,18 @@ function ping_init(&$a) { } } + + $t2 = dba_timer(); + $intros1 = q("SELECT `intro`.`id`, `intro`.`datetime`, `fcontact`.`name`, `fcontact`.`url`, `fcontact`.`photo` FROM `intro` LEFT JOIN `fcontact` ON `intro`.`fid` = `fcontact`.`id` WHERE `intro`.`uid` = %d AND `intro`.`blocked` = 0 AND `intro`.`ignore` = 0 AND `intro`.`fid`!=0", intval(local_user()) ); + + $t3 = dba_timer(); + $intros2 = q("SELECT `intro`.`id`, `intro`.`datetime`, `contact`.`name`, `contact`.`url`, `contact`.`photo` FROM `intro` LEFT JOIN `contact` ON `intro`.`contact-id` = `contact`.`id` @@ -124,6 +134,8 @@ function ping_init(&$a) { $intros = count($intros1) + count($intros2); $result['intros'] = intval($intros); + $t4 = dba_timer(); + $myurl = $a->get_baseurl() . '/profile/' . $a->user['nickname'] ; $mails = q("SELECT *, COUNT(*) AS `total` FROM `mail` WHERE `uid` = %d AND `seen` = 0 AND `from-url` != '%s' ", @@ -138,8 +150,18 @@ function ping_init(&$a) { if($regs) $result['register'] = intval($regs[0]['total']); } + + $t5 = dba_timer(); + + + + $x = json_encode($result); - echo json_encode($result); + $t6 = dba_timer(); + +// logger('ping timer: ' . sprintf('%01.4f %01.4f %01.4f %01.4f %01.4f %01.4f',$t6 - $t5, $t5 - $t4, $t4 - $t3, $t3 - $t2, $t2 - $t1, $t1 - $t0)); + + echo $x; killme(); } -- cgit v1.2.3