diff options
author | friendica <info@friendica.com> | 2013-02-09 02:46:50 -0800 |
---|---|---|
committer | friendica <info@friendica.com> | 2013-02-09 02:46:50 -0800 |
commit | 55df911403e64ce02fa910fa59bfe8ec7d907608 (patch) | |
tree | ebe0cc9df1e0cec355737f6b7147ad446bd47f66 | |
parent | 28b11f3567deff72dff943af67ab963b98262eda (diff) | |
download | volse-hubzilla-55df911403e64ce02fa910fa59bfe8ec7d907608.tar.gz volse-hubzilla-55df911403e64ce02fa910fa59bfe8ec7d907608.tar.bz2 volse-hubzilla-55df911403e64ce02fa910fa59bfe8ec7d907608.zip |
performance profiling - 95% of the time is spent in "conversation()" e.g. rendering and templates, even with the new theme engine. The time spent in the DB is miniscule. Will have to profile the bbcode processing and template engines individually to drill down further.
-rw-r--r-- | include/text.php | 4 | ||||
-rw-r--r-- | mod/network.php | 28 |
2 files changed, 26 insertions, 6 deletions
diff --git a/include/text.php b/include/text.php index 8cb3a930a..d0b2733c0 100644 --- a/include/text.php +++ b/include/text.php @@ -489,6 +489,10 @@ function dlogger($msg,$level = 0) { }} +function profiler($t1,$t2,$label) { + if(file_exists('profiler.out') && $t1 && t2) + @file_put_contents('profiler.out', sprintf('%01.4f %s',$t2 - $t1,$label) . "\n", FILE_APPEND); +} if(! function_exists('activity_match')) { diff --git a/mod/network.php b/mod/network.php index 641029a76..a0c55d852 100644 --- a/mod/network.php +++ b/mod/network.php @@ -560,7 +560,7 @@ function network_content(&$a, $update = 0, $load = false) { } else { $itemspage = get_pconfig(local_user(),'system','itemspage'); - $a->set_pager_itemspage(((intval($itemspage)) ? $itemspage : 40)); + $a->set_pager_itemspage(((intval($itemspage)) ? $itemspage : 30)); $pager_sql = sprintf(" LIMIT %d, %d ",intval($a->pager['start']), intval($a->pager['itemspage'])); } @@ -647,6 +647,7 @@ function network_content(&$a, $update = 0, $load = false) { } + $first = dba_timer(); // Then fetch all the children of the parents that are on this page @@ -662,12 +663,20 @@ function network_content(&$a, $update = 0, $load = false) { dbesc($parents_str) ); + $second = dba_timer(); + xchan_query($items); + $third = dba_timer(); + $items = fetch_post_tags($items); + $fourth = dba_timer(); + $items = conv_sort($items,$ordering); + + //logger('items: ' . print_r($items,true)); } @@ -692,19 +701,26 @@ function network_content(&$a, $update = 0, $load = false) { $mode = (($nouveau) ? 'network-new' : 'network'); - $first = dba_timer(); + $fifth = dba_timer(); $o .= conversation($a,$items,$mode,$update,'client'); + $sixth = dba_timer(); - $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)); - + if($load) { + profiler($start,$first,'network parents'); + profiler($first,$second,'network children'); + profiler($second,$third,'network authors'); + profiler($third,$fourth,'network tags'); + profiler($fourth,$fifth,'network sort'); + profiler($fifth,$sixth,'network render'); + profiler($start,$sixth,'network total'); + profiler(1,1,'--'); + } return $o; } |