A
A
Andrey Salnikov2016-04-14 10:57:58
PHP
Andrey Salnikov, 2016-04-14 10:57:58

How to check speed in MODX?

Generally got the site. It's on MODX, we need to optimize it. I don't even know where to start. Everywhere they write - to work with the cache, but they write that in places where there are some checks - it is not desirable. And I have snippets with parameters in my code - snippets. There are 2 pdoMenu + pdoPage on one page, and if pdoPage is called with caching (ie ), then a full ... guard is created. + there are subdomains managed through the same admin panel and there are many checks on the site itself. There are snippets made as snippets (this is for displaying prices, etc.), and there are made in chunks via http://askmeplz.com/. And I don't know what can be cached and what can't. Is it possible to measure the speed in different parts of the template in general? How much time is spent on such and such a piece, how much on another?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Sanes, 2016-04-14
@Shshzik

<?php
define('MODX_API_MODE', true);
require 'index.php';

$pdo = $modx->getService('pdoTools');
$tpl = '@INLINE <p> -  - </p>';

$output = '';
for ($i = 0; $i <= 10000; $i ++) {
  $array = array('val1' => rand(), 'val2' => rand(), 'val3' => rand());
  $output .= $pdo->getChunk($tpl, $array);
}

echo '<pre>'; print_r($pdo->getTime()); echo '</pre>';
echo $output;

Here are my results . Considered good.
And debugParser is now free .

D
DarkMatter, 2016-04-14
@darkmatter

See what queries are being made and make those queries directly with EXPLAIN SELECT

Z
zooks, 2016-04-14
@zooks

Paste in the template before the closing</body>
<!-- 0.1837 s, 9, 0.0013 s -->

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question