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 --- include/conversation.php | 22 ++++++++++++ include/template_processor.php | 6 ++++ js/main.js | 39 ++++++++++++---------- mod/network.php | 15 +++++++-- mod/ping.php | 24 ++++++++++++- view/acl_selector.tpl | 14 ++++---- view/jot-header.tpl | 1 + view/theme/slackr/birthdays_reminder.tpl | 8 ----- view/theme/slackr/birthdays_reminder.tpl.newlayout | 8 +++++ view/theme/slackr/events_reminder.tpl | 39 ---------------------- 10 files changed, 102 insertions(+), 74 deletions(-) delete mode 100644 view/theme/slackr/birthdays_reminder.tpl create mode 100644 view/theme/slackr/birthdays_reminder.tpl.newlayout delete mode 100644 view/theme/slackr/events_reminder.tpl diff --git a/include/conversation.php b/include/conversation.php index c7406b1dc..f0d453cf5 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -311,6 +311,7 @@ function localize_item(&$item){ if(!function_exists('conversation')) { function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional') { + $tstart = dba_timer(); require_once('bbcode.php'); @@ -522,6 +523,8 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional') { $comments = array(); foreach($items as $item) { + + if((intval($item['gravity']) == 6) && ($item['id'] != $item['parent'])) { if(! x($comments,$item['parent'])) $comments[$item['parent']] = 1; @@ -549,6 +552,8 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional') { foreach($items as $item) { + $tfirst = dba_timer(); + $comment = ''; $template = $tpl; $commentww = ''; @@ -872,8 +877,21 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional') { call_hooks('display_item', $arr); $threads[$threadsid]['items'][] = $arr['output']; + + $tlast = dba_timer(); + +// logger('render dba_timer: item# ' . $item['id'] . ' ' . sprintf('%01.4f',$tlast - $tfirst)); + + + + } } + +// logger('render total dba_timer: ' . sprintf('%01.4f',$tlast - $tstart)); + + + } // logger('threads: ' . count($threads) . ' update: ' . $update); @@ -907,6 +925,10 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional') { )); } + $tfinal = dba_timer(); +// logger('render template dba_timer: ' . sprintf('%01.4f',$tfinal - $tlast)); + + return $o; }} diff --git a/include/template_processor.php b/include/template_processor.php index 46252c355..e891b8bf2 100644 --- a/include/template_processor.php +++ b/include/template_processor.php @@ -189,6 +189,7 @@ } public function replace($s, $r) { +// $t1 = dba_timer(); $this->r = $r; $s = $this->_build_nodes($s); @@ -199,12 +200,17 @@ // remove comments block $s = preg_replace('/{#[^#]*#}/', "" , $s); +// $t2 = dba_timer(); + // replace strings recursively (limit to 10 loops) $os = ""; $count=0; while($os!=$s && $count<10){ $os=$s; $count++; $s = $this->var_replace($s); } +// $t3 = dba_timer(); +// logger('macro timer: ' . sprintf('%01.4f %01.4f',$t3 - $t2, $t2 - $t1)); + return $s; } } diff --git a/js/main.js b/js/main.js index 1454dd0b5..bdc1c83e3 100644 --- a/js/main.js +++ b/js/main.js @@ -154,6 +154,27 @@ window.location.href=window.location.href } + + // start live update + + if($('#live-network').length) { src = 'network'; liveUpdate(); } + if($('#live-profile').length) { src = 'profile'; liveUpdate(); } + if($('#live-community').length) { src = 'community'; liveUpdate(); } + if($('#live-notes').length) { src = 'notes'; liveUpdate(); } + if($('#live-display').length) { + if(liking) { + liking = 0; + window.location.href=window.location.href + } + } + if($('#live-photos').length) { + if(liking) { + liking = 0; + window.location.href=window.location.href + } + } + + if(data.network == 0) { data.network = ''; $('#net-update').removeClass('show') @@ -188,24 +209,6 @@ }); - // start live update - - if($('#live-network').length) { src = 'network'; liveUpdate(); } - if($('#live-profile').length) { src = 'profile'; liveUpdate(); } - if($('#live-community').length) { src = 'community'; liveUpdate(); } - if($('#live-notes').length) { src = 'notes'; liveUpdate(); } - if($('#live-display').length) { - if(liking) { - liking = 0; - window.location.href=window.location.href - } - } - if($('#live-photos').length) { - if(liking) { - liking = 0; - window.location.href=window.location.href - } - } }) ; } 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(); } diff --git a/view/acl_selector.tpl b/view/acl_selector.tpl index 655ea8980..e5231b0f8 100644 --- a/view/acl_selector.tpl +++ b/view/acl_selector.tpl @@ -16,11 +16,13 @@ diff --git a/view/jot-header.tpl b/view/jot-header.tpl index 64bcf27ca..f777e997f 100644 --- a/view/jot-header.tpl +++ b/view/jot-header.tpl @@ -103,6 +103,7 @@ function initEditor(cb){ } }); + editor = true; // setup acl popup $("a#jot-perms-icon").fancybox({ diff --git a/view/theme/slackr/birthdays_reminder.tpl b/view/theme/slackr/birthdays_reminder.tpl deleted file mode 100644 index 1dc65295a..000000000 --- a/view/theme/slackr/birthdays_reminder.tpl +++ /dev/null @@ -1,8 +0,0 @@ -{{ if $classtoday }} - -{{ endif }} - diff --git a/view/theme/slackr/birthdays_reminder.tpl.newlayout b/view/theme/slackr/birthdays_reminder.tpl.newlayout new file mode 100644 index 000000000..1dc65295a --- /dev/null +++ b/view/theme/slackr/birthdays_reminder.tpl.newlayout @@ -0,0 +1,8 @@ +{{ if $classtoday }} + +{{ endif }} + diff --git a/view/theme/slackr/events_reminder.tpl b/view/theme/slackr/events_reminder.tpl deleted file mode 100644 index bd1a57d18..000000000 --- a/view/theme/slackr/events_reminder.tpl +++ /dev/null @@ -1,39 +0,0 @@ - - - -
-
-- cgit v1.2.3