Created
August 29, 2023 18:04
-
-
Save nielsdos/5b59de15b4f1572b2147980eb0687df3 to your computer and use it in GitHub Desktop.
HTML5 benchmarking
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
<?php | |
include "sites.php"; | |
if (count($_SERVER["argv"]) != 3) { | |
echo "Usage: php execute_bench.php <id> <class>\n"; | |
exit(1); | |
} | |
$id = (int) $_SERVER["argv"][1]; | |
$class = $_SERVER["argv"][2]; | |
$site = $sites[$id]; | |
$contents = file_get_contents(__DIR__."/sites/$site.html"); | |
for ($i = 0; $i < 300; $i++) { | |
$doc = new $class(); | |
$doc->loadHTML($contents, LIBXML_NOERROR); | |
} |
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
#!/bin/bash | |
mkdir -p output | |
#for i in $(seq 0 1); do | |
for i in $(seq 0 42); do | |
hyperfine --warmup 3 --export-json "output/$i.json" "../sapi/cli/php execute_bench.php $i DOMDocument" "../sapi/cli/php execute_bench.php $i DOM\\\\HTML5Document" | |
done |
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
<?php | |
$sites = [ | |
"google.com", | |
"youtube.com", | |
"facebook.com", | |
"instagram.com", | |
"twitter.com", | |
"baidu.com", | |
"wikipedia.org", | |
"yahoo.com", | |
"yandex.ru", | |
"whatsapp.com", | |
"amazon.com", | |
"tiktok.com", | |
"yahoo.co.jp", | |
"live.com", | |
"docomo.ne.jp", | |
"reddit.com", | |
"linkedin.com", | |
"netflix.com", | |
"openai.com", | |
"dzen.ru", | |
"weather.com", | |
"office.com", | |
"samsung.com", | |
"vk.com", | |
"turbopages.org", | |
"bing.com", | |
"naver.com", | |
"discord.com", | |
"mail.ru", | |
"twitch.tv", | |
"pinterest.com", | |
"bilibili.com", | |
"max.com", | |
"roblox.com", | |
"duckduckgo.com", | |
"fandom.com", | |
"microsoft.com", | |
"zoom.us", | |
"qq.com", | |
"ebay.com", | |
"t.me", | |
"globo.com", | |
"booking.com" | |
]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment