generated from 8fold/github-repo-template
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
630 additions
and
7 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
<?php | ||
$start = hrtime(true); | ||
?> | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<title>Page title here</title> | ||
<meta charset="utf-8"> | ||
</head> | ||
<body> | ||
<h1>Page title here</h1> | ||
<p><a href="#bottom">time</a></p> | ||
<artcle> | ||
<section> | ||
<h2>Blog title 1</h2> | ||
<p>Brief description of content for blog post 1</p> | ||
<p><a href="#">Read blog post 1</a></p> | ||
</section> | ||
<section> | ||
<h2>Blog title 2</h2> | ||
<p>Brief description of content for blog post 2</p> | ||
<p><a href="#">Read blog post 2</a></p> | ||
</section> | ||
<section> | ||
<h2>Blog title 3</h2> | ||
<p>Brief description of content for blog post 3</p> | ||
<p><a href="#">Read blog post 3</a></p> | ||
</section> | ||
<section> | ||
<h2>Blog title 4</h2> | ||
<p>Brief description of content for blog post 4</p> | ||
<p><a href="#">Read blog post 4</a></p> | ||
</section> | ||
<section> | ||
<h2>Blog title 5</h2> | ||
<p>Brief description of content for blog post 5</p> | ||
<p><a href="#">Read blog post 5</a></p> | ||
</section> | ||
<section> | ||
<h2>Blog title 6</h2> | ||
<p>Brief description of content for blog post 6</p> | ||
<p><a href="#">Read blog post 6</a></p> | ||
</section> | ||
<section> | ||
<h2>Blog title 7</h2> | ||
<p>Brief description of content for blog post 7</p> | ||
<p><a href="#">Read blog post 7</a></p> | ||
</section> | ||
<section> | ||
<h2>Blog title 8</h2> | ||
<p>Brief description of content for blog post 8</p> | ||
<p><a href="#">Read blog post 8</a></p> | ||
</section> | ||
<section> | ||
<h2>Blog title 9</h2> | ||
<p>Brief description of content for blog post 9</p> | ||
<p><a href="#">Read blog post 9</a></p> | ||
</section> | ||
<section> | ||
<h2>Blog title 10</h2> | ||
<p>Brief description of content for blog post 10</p> | ||
<p><a href="#">Read blog post 10</a></p> | ||
</section> | ||
</artcle> | ||
<?php | ||
$end = hrtime(true); | ||
|
||
$elapsed = $end - $start; | ||
$ms = $elapsed/1e+6; | ||
|
||
print('<p id="bottom"><b>' . $ms . 'ms</b></p>'); | ||
?> | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<ol> | ||
<li>Start PHP server and point to `/comparisons`</li> | ||
<li>Launch browser to the root address</li> | ||
<li>Click link of page to be tested</li> | ||
<li>Note displayed render time in milliseconds</li> | ||
<li>Refresh browser 11 times; making not of render times (should result in 12 times)</li> | ||
<li>Calculate average and median</li> | ||
</ol> | ||
<dl> | ||
<dt><a href="/html/">Plain HTML</a></dt> | ||
<dd>Has minimal PHP for measuring time</dd> | ||
<dt><a href="/php/">PHP</a></dt> | ||
<dd>Replicates the Plain HTML using common patterns using PHP as a template engine.</dd> | ||
<dt><a href="/php-html-builder-element/">PHP HTML Builder (element)</a></dt> | ||
<dd>Replicates the PHP variant using PHP HTML Builder Element to generate the `article` and `section` elements. Does not use Composer autoloading.</dd> | ||
<dt><a href="/php-html-builder-document/">PHP HTML Builder (document)</a></dt> | ||
<dd>Replicates the PHP variant using PHP HTML Builder Document to generate the whole HTML output. Does not use Composer autoloading.</dd> | ||
<dt><a href="/php-html-builder-document-psr4/">PHP HTML Builder (document) w/ PSR-4</a></dt> | ||
<dd>Replicates the PHP HTML Builder (document) variant using PSR-4 autoloading via Composer.</dd> | ||
</dl> | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
<?php | ||
|
||
ini_set('display_errors', '1'); | ||
ini_set('display_startup_errors', '1'); | ||
error_reporting(E_ALL); | ||
|
||
$start = hrtime(true); | ||
|
||
require_once(__DIR__ . '/../../vendor/autoload.php'); | ||
|
||
$pageTitle = "Page title here"; | ||
|
||
$posts = [ | ||
[ | ||
"title" => "Blog title 1", | ||
"description" => "Brief description for blog post 1", | ||
"url" => [ | ||
"href" => "#", | ||
"text" => "Read blog post 1" | ||
] | ||
], | ||
[ | ||
"title" => "Blog title 2", | ||
"description" => "Brief description for blog post 2", | ||
"url" => [ | ||
"href" => "#", | ||
"text" => "Read blog post 2" | ||
] | ||
], | ||
[ | ||
"title" => "Blog title 3", | ||
"description" => "Brief description for blog post 3", | ||
"url" => [ | ||
"href" => "#", | ||
"text" => "Read blog post 3" | ||
] | ||
], | ||
[ | ||
"title" => "Blog title 4", | ||
"description" => "Brief description for blog post 4", | ||
"url" => [ | ||
"href" => "#", | ||
"text" => "Read blog post 4" | ||
] | ||
], | ||
[ | ||
"title" => "Blog title 5", | ||
"description" => "Brief description for blog post 5", | ||
"url" => [ | ||
"href" => "#", | ||
"text" => "Read blog post 5" | ||
] | ||
], | ||
[ | ||
"title" => "Blog title 6", | ||
"description" => "Brief description for blog post 6", | ||
"url" => [ | ||
"href" => "#", | ||
"text" => "Read blog post 6" | ||
] | ||
], | ||
[ | ||
"title" => "Blog title 7", | ||
"description" => "Brief description for blog post 7", | ||
"url" => [ | ||
"href" => "#", | ||
"text" => "Read blog post 7" | ||
] | ||
], | ||
[ | ||
"title" => "Blog title 8", | ||
"description" => "Brief description for blog post 8", | ||
"url" => [ | ||
"href" => "#", | ||
"text" => "Read blog post 8" | ||
] | ||
], | ||
[ | ||
"title" => "Blog title 9", | ||
"description" => "Brief description for blog post 9", | ||
"url" => [ | ||
"href" => "#", | ||
"text" => "Read blog post 9" | ||
] | ||
], | ||
[ | ||
"title" => "Blog title 10", | ||
"description" => "Brief description for blog post 10", | ||
"url" => [ | ||
"href" => "#", | ||
"text" => "Read blog post 10" | ||
] | ||
] | ||
]; | ||
|
||
$sections = []; | ||
foreach ($posts as $post) { | ||
$sections[] = \Eightfold\HTMLBuilder\Element::section( | ||
\Eightfold\HTMLBuilder\Element::h2($post['title']), | ||
\Eightfold\HTMLBuilder\Element::p($post['description']), | ||
\Eightfold\HTMLBuilder\Element::p( | ||
\Eightfold\HTMLBuilder\Element::a($post['url']['text']) | ||
->props('href ' . $post['url']['href']) | ||
) | ||
); | ||
} | ||
|
||
print \Eightfold\HTMLBuilder\Document::create( | ||
$pageTitle | ||
)->body( | ||
\Eightfold\HTMLBuilder\Element::h1($pageTitle), | ||
\Eightfold\HTMLBuilder\Element::a('time')->props('href #bottom'), | ||
\Eightfold\HTMLBuilder\Element::article(...$sections) | ||
); | ||
|
||
$end = hrtime(true); | ||
|
||
$elapsed = $end - $start; | ||
$ms = $elapsed/1e+6; | ||
|
||
print('<p id="bottom"><b>' . $ms . 'ms</b></p>'); | ||
?> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
<?php | ||
|
||
ini_set('display_errors', '1'); | ||
ini_set('display_startup_errors', '1'); | ||
error_reporting(E_ALL); | ||
|
||
$start = hrtime(true); | ||
|
||
require_once(__DIR__ . '/../../vendor/8fold/php-xml-builder/src/Contracts/Contentable.php'); | ||
require_once(__DIR__ . '/../../vendor/8fold/php-xml-builder/src/Contracts/ContentWithoutElement.php'); | ||
|
||
require_once(__DIR__ . '/../../vendor/8fold/php-xml-builder/src/Implementations/Properties.php'); | ||
require_once(__DIR__ . '/../../vendor/8fold/php-xml-builder/src/Implementations/Contentable.php'); | ||
require_once(__DIR__ . '/../../vendor/8fold/php-xml-builder/src/Implementations/ContentWithoutElement.php'); | ||
|
||
require_once(__DIR__ . '/../../vendor/8fold/php-xml-builder/src/Concatenate.php'); | ||
require_once(__DIR__ . '/../../vendor/8fold/php-xml-builder/src/Element.php'); | ||
|
||
require_once(__DIR__ . '/../../src/Document.php'); | ||
require_once(__DIR__ . '/../../src/Element.php'); | ||
|
||
$pageTitle = "Page title here"; | ||
|
||
$posts = [ | ||
[ | ||
"title" => "Blog title 1", | ||
"description" => "Brief description for blog post 1", | ||
"url" => [ | ||
"href" => "#", | ||
"text" => "Read blog post 1" | ||
] | ||
], | ||
[ | ||
"title" => "Blog title 2", | ||
"description" => "Brief description for blog post 2", | ||
"url" => [ | ||
"href" => "#", | ||
"text" => "Read blog post 2" | ||
] | ||
], | ||
[ | ||
"title" => "Blog title 3", | ||
"description" => "Brief description for blog post 3", | ||
"url" => [ | ||
"href" => "#", | ||
"text" => "Read blog post 3" | ||
] | ||
], | ||
[ | ||
"title" => "Blog title 4", | ||
"description" => "Brief description for blog post 4", | ||
"url" => [ | ||
"href" => "#", | ||
"text" => "Read blog post 4" | ||
] | ||
], | ||
[ | ||
"title" => "Blog title 5", | ||
"description" => "Brief description for blog post 5", | ||
"url" => [ | ||
"href" => "#", | ||
"text" => "Read blog post 5" | ||
] | ||
], | ||
[ | ||
"title" => "Blog title 6", | ||
"description" => "Brief description for blog post 6", | ||
"url" => [ | ||
"href" => "#", | ||
"text" => "Read blog post 6" | ||
] | ||
], | ||
[ | ||
"title" => "Blog title 7", | ||
"description" => "Brief description for blog post 7", | ||
"url" => [ | ||
"href" => "#", | ||
"text" => "Read blog post 7" | ||
] | ||
], | ||
[ | ||
"title" => "Blog title 8", | ||
"description" => "Brief description for blog post 8", | ||
"url" => [ | ||
"href" => "#", | ||
"text" => "Read blog post 8" | ||
] | ||
], | ||
[ | ||
"title" => "Blog title 9", | ||
"description" => "Brief description for blog post 9", | ||
"url" => [ | ||
"href" => "#", | ||
"text" => "Read blog post 9" | ||
] | ||
], | ||
[ | ||
"title" => "Blog title 10", | ||
"description" => "Brief description for blog post 10", | ||
"url" => [ | ||
"href" => "#", | ||
"text" => "Read blog post 10" | ||
] | ||
] | ||
]; | ||
|
||
$sections = []; | ||
foreach ($posts as $post) { | ||
$sections[] = \Eightfold\HTMLBuilder\Element::section( | ||
\Eightfold\HTMLBuilder\Element::h2($post['title']), | ||
\Eightfold\HTMLBuilder\Element::p($post['description']), | ||
\Eightfold\HTMLBuilder\Element::p( | ||
\Eightfold\HTMLBuilder\Element::a($post['url']['text']) | ||
->props('href ' . $post['url']['href']) | ||
) | ||
); | ||
} | ||
|
||
print \Eightfold\HTMLBuilder\Document::create( | ||
$pageTitle | ||
)->body( | ||
\Eightfold\HTMLBuilder\Element::h1($pageTitle), | ||
\Eightfold\HTMLBuilder\Element::a('time')->props('href #bottom'), | ||
\Eightfold\HTMLBuilder\Element::article(...$sections) | ||
); | ||
|
||
$end = hrtime(true); | ||
|
||
$elapsed = $end - $start; | ||
$ms = $elapsed/1e+6; | ||
|
||
print('<p id="bottom"><b>' . $ms . 'ms</b></p>'); | ||
?> |
Oops, something went wrong.