Four times slower processing, wonder why

From: Date: Wed, 17 Sep 2003 05:21:31 +0000
Subject: Four times slower processing, wonder why
Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-10228@lists.php.net to get a copy of this message
Hello everybody, I am building a simple application and run some tests for speed. When the output is done, the script prints out the total execution time. Even with a valid cache, it takes about 1/4 second to display, as much as when it parses everything. I thought it possibly didn't see the cache and added some debugging lines in "_read_cache_file()" : simple "echo"-es to know which line it returns false, and it worked! 0.04 seconds only! ... The constatation : (with a valid cache) * if there IS an output to the browser before the $smarty->display() method, it is fast, 0.04 sec * if $smarty->display() is the first otput, it takes 4 times more to process, 0.22 sec. Do you have an idea why it is happening? It is not wise to print something before display(), as it may send only a "Not-modified" header. Did someone have the same problem? Thank you very much if you can answer. Best regards, Petko <? require("config.php"); $cached_or_parsed = "cached"; if(!$smarty->is_cached($this_template, "$lang|$content")) { $cached_or_parsed = "*parsed*"; $smarty->assign('confname', "$content.ini"); $smarty->assign('lang', $lang); ... } /* if I put here ``echo " ";'' it is fast, else it is slow */ $smarty->display($this_template, "$lang|$content"); echo "Sending $cached_or_parsed content in ".getprocesstime()." seconds."; ?>

« previous php.smarty.general (#10228) next »