ProcessWire - Performance: Unterschied zwischen den Versionen
Aus Wikizone
(Die Seite wurde neu angelegt: „== Performance Testen == === Zeit und RAM === <syntaxhighlight lang="php"> </syntaxhighlight> // 8000 pages with title and body fields $pp = $pages('template=b…“) |
|||
| Zeile 2: | Zeile 2: | ||
=== Zeit und RAM === | === Zeit und RAM === | ||
<syntaxhighlight lang="php"> | <syntaxhighlight lang="php"> | ||
| − | + | ||
// 8000 pages with title and body fields | // 8000 pages with title and body fields | ||
$pp = $pages('template=basic, parent=1384'); | $pp = $pages('template=basic, parent=1384'); | ||
| Zeile 14: | Zeile 14: | ||
// 18384.08ms, 25.00 MB | // 18384.08ms, 25.00 MB | ||
| − | |||
// 8000 pages with title and body fields | // 8000 pages with title and body fields | ||
$pp = $pages('template=basic, parent=1384'); | $pp = $pages('template=basic, parent=1384'); | ||
| Zeile 25: | Zeile 24: | ||
// 17617.05ms, 25.00MB | // 17617.05ms, 25.00MB | ||
| − | |||
$out = ''; | $out = ''; | ||
foreach($pages('template=basic, parent=1384') as $p) { | foreach($pages('template=basic, parent=1384') as $p) { | ||
| Zeile 33: | Zeile 31: | ||
echo strlen($out); | echo strlen($out); | ||
// 17927.9ms, 25.00MB | // 17927.9ms, 25.00MB | ||
| − | + | </syntaxhighlight> | |
<syntaxhighlight lang="php"> | <syntaxhighlight lang="php"> | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Version vom 12. Februar 2020, 10:09 Uhr
Performance Testen
Zeit und RAM
// 8000 pages with title and body fields
$pp = $pages('template=basic, parent=1384');
$out = '';
foreach($pp as $p) {
$t = $p->title . microtime();
$b = $p->body . mt_rand(0, 1e5);
$out .= $t . $b;
}
echo strlen($out);
// 18384.08ms, 25.00 MB
// 8000 pages with title and body fields
$pp = $pages('template=basic, parent=1384');
$out = '';
foreach($pp as $p) {
$out .= $p->title . microtime();
$out .= $p->body . mt_rand(0, 1e5);
}
echo strlen($out);
// 17617.05ms, 25.00MB
$out = '';
foreach($pages('template=basic, parent=1384') as $p) {
$out .= $p->title . microtime();
$out .= $p->body . mt_rand(0, 1e5);
}
echo strlen($out);
// 17927.9ms, 25.00MB