Reputation: 3654
I did some benchmarking on the script that loads up all the products from a category, route=product/category
. I inserted a few microtime functions throughout the script and got the following results:
Array
(
[0] => 1386295629.1175
[1] => 1386295629.1556
[2] => 1386295629.1562
[3] => 1386295629.1562
[4] => 1386295629.4826
[5] => 1386295629.49
[6] => 1386295629.4908
[7] => 1386295629.491
)
From start to finish, it takes 0.3735 seconds to load the data for the entire page. This includes all SQL queries and image resizing (if needed). I ran the benchmark on this page:
http://www.hollywoodcollectibles.com/baseball/autographed-baseball-balls
You'll notice that it takes over 10 seconds to load that page and most of that time is used on the request and not the response. So the bottleneck is in fact not in SQL at all. Most other categories, that contain a smaller amount of products, don't experience this bottleneck at all.
I ran another benchmark, this time measuring how long it takes to render the actual output, $this->response->setOutput($this->render());
Array
(
[0] => 1386296946.8589
[1] => 1386296964.206
)
Now, we're getting somewhere. Opencart took 17.34 seconds to render the output.
After this, I'm lost. Can anyone point me to where $this->render()
function is in Opencart and possibly give me any other suggestions of where to look for the bottleneck?
Upvotes: 0
Views: 391
Reputation: 694
I don't know if this will help you but that function is in system/engine/controller.php
protected function render() {
foreach ($this->children as $child) {
$this->data[basename($child)] = $this->getChild($child);
}
if (file_exists(DIR_TEMPLATE . $this->template)) {
extract($this->data);
ob_start();
require(DIR_TEMPLATE . $this->template);
$this->output = ob_get_contents();
ob_end_clean();
return $this->output;
} else {
trigger_error('Error: Could not load template ' . DIR_TEMPLATE . $this->template . '!');
exit();
}
}
there is another function render() in system/library/pagination.php
but that is just for the pagination i believe.
Upvotes: 1