-
-
Save timohausmann/e7643d75e26135450dab63e33c94de8f to your computer and use it in GitHub Desktop.
Processwire Markup Regions Benchmark for 15 "Content Blocks" with individual styles
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang='en'> | |
<head> | |
<meta http-equiv='content-type' content='text/html; charset=utf-8'> | |
<title><?=$page->title?></title> | |
<style id="style"> | |
</style> | |
</head> | |
<body> | |
<h1 id='headline'> | |
<?=$page->title?> | |
</h1> | |
<div id='content'> | |
</div> | |
<div id='sidebar'> | |
</div> | |
<div id='footer'> | |
<p>Powered by ProcessWire</p> | |
<p>Copyright <?=date('Y')?></p> | |
</div> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ul class='subnav' pw-prepend='sidebar'> | |
<?php for($i=0; $i<8; $i++) { | |
echo "<li><a href='#anchor-{$i}'>item {$i}</a></li>"; | |
} ?> | |
</ul> | |
<h2 id="headline">Home Headline</h2> | |
<?php | |
/** | |
* Processwire Markup Regions Benchmark for 15 "Content Blocks" with individual styles | |
* | |
* Rendering times are "TTFB" from Chrome Dev Tools on Windows 10 local WAMP with no SSD | |
* This example file currently has nested regions "content" and "style" ("Medium" Setup). | |
* | |
* 1) Fastest (~105ms): no markup regions, set $config->useMarkupRegions = false in config.php | |
* or remove the ids and pw-append in this file (although it's rendered twice then) | |
* 2) Medium (~215ms): nested regions (as-is) | |
* 3) Slowest (~280ms): no nested regions but content region per block with pw-append | |
* remove line 23 and 47 and uncomment line 35 and 44 around the <span> and <img> | |
*/ | |
?> | |
<div id="content"> | |
<?php for($i=1; $i<16;$i++) { ?> | |
<style id="style" pw-append> | |
<?php | |
echo '.img-'. $i .'{'; | |
echo 'transform: rotate('. ($i * 12) .'deg);'; | |
echo 'width: '. ($i * 16) .'px;'; | |
echo '}'; | |
?> | |
</style> | |
<?php //echo '<div id="content" pw-append>'; ?> | |
<span>#<?php echo $i; ?></span> | |
<img src='https://picsum.photos/256/256' class='img-<?php echo $i; ?>' /> | |
<?php //echo '</div>'; ?> | |
<?php } ?> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment