papai Posted April 27, 2008 Share Posted April 27, 2008 I measured response time of website. The original response time is about 20-25 s. After that, I uninstalled category block, response time reduce to 4-5 s. Surprisingly, I opened category block's code, I found that there are too many call for template (to recursive to make tree). That's bad technique. I think weak performance caused by programming technique not by smarty technology. Any one find more cause, pls public for our community. It's very good if these causes are removed. Link to comment Share on other sites More sharing options...
papai Posted April 27, 2008 Author Share Posted April 27, 2008 I have complicated menu, but I fixed this software and now response time is about 6-7 s. Great ;D Link to comment Share on other sites More sharing options...
dddirk Posted April 27, 2008 Share Posted April 27, 2008 coud you please explain, what you have changed? thank you Link to comment Share on other sites More sharing options...
Thierry Posted April 30, 2008 Share Posted April 30, 2008 I am also interested. Link to comment Share on other sites More sharing options...
papai Posted May 5, 2008 Author Share Posted May 5, 2008 There are some ways to speed up website: 1. Don't use smart technique. Following function is to get HTML code for category tree without smarty. Website's speed is doubled function getHTMLCategTree($catSelected=0, $maxDepth = 3, $currentDepth = 0, $idLang = NULL) { global $link; //get idLang $idLang = is_null($idLang) ? _USER_ID_LANG_ : intval($idLang); //recursivity for subcategories $childrenNodes = ""; $subcats = $this->getSubCategories($idLang, true); if (sizeof($subcats) AND ($maxDepth == 0 OR $currentDepth < $maxDepth)) { foreach ($subcats as $subcat) { if (!$subcat['id_category']) break ; $categ = new Category($subcat['id_category'] ,$idLang); $HTMLcatItem = "<li>"; if ($catSelected == $categ->id) $HTMLcatItem = $HTMLcatItem . '<a href="'.$link->getCategoryLink($categ->id, $categ->link_rewrite).'" class="selected" title="'.$categ->description.'">'.$categ->name.'</a>'; else $HTMLcatItem = $HTMLcatItem . '<a href="'.$link->getCategoryLink($categ->id, $categ->link_rewrite).'" title="'.$categ->description.'">'.$categ->name.'</a>'; $HTMLcatItem = $HTMLcatItem .$categ->getHTMLCategTree($catSelected, $maxDepth, $currentDepth + 1, $idLang); $HTMLcatItem = $HTMLcatItem . "</li>"; $childrenNodes = $childrenNodes . $HTMLcatItem; } $childrenNodes = "<ul>" . $childrenNodes . "</ul>"; } return $childrenNodes; } 2. If you want to use smarty, let set cache for smarty object. This improves speed surprisingly. Best regard, ;D Link to comment Share on other sites More sharing options...
geodeath Posted May 6, 2008 Share Posted May 6, 2008 Hi, i am interested in this modification. In which file do you apply it and how? I did a file text search for this function and i couldnt find it. thanks George Link to comment Share on other sites More sharing options...
Aravind Posted December 13, 2008 Share Posted December 13, 2008 Hi D,Thanks for you information on Categories week performance. I appriciate if you could send me the details when can to change the code to get high performance.ThanksAravinda Link to comment Share on other sites More sharing options...
Damien Metzger Posted December 14, 2008 Share Posted December 14, 2008 This bug is fixed in the 1.1 version and it should be compatible with the 1.0. Link to comment Share on other sites More sharing options...
migash Posted September 16, 2009 Share Posted September 16, 2009 Where are you placing the "function getHTMLCategTree" code and how are you calling it. Thanks. Link to comment Share on other sites More sharing options...
mhu100 Posted October 14, 2009 Share Posted October 14, 2009 Please more info on how to implement. Thanks! Link to comment Share on other sites More sharing options...
Recommended Posts