Update bench tests

This commit is contained in:
Wilson Lin 2020-01-08 12:35:39 +11:00
parent 55a24aeef2
commit bb42be10c8
25 changed files with 409525 additions and 86593 deletions

1
bench/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
node_modules/

42
bench/fetch.js Normal file
View File

@ -0,0 +1,42 @@
const {promises: fs} = require('fs');
const request = require('request-promise-native');
const path = require('path');
const prettier = require('prettier');
const tests = {
"Amazon": "https://amazon.com/",
"Bootstrap": "https://getbootstrap.com/docs/3.4/css/",
"Bing": "https://bing.com/",
"Coding Horror": "https://blog.codinghorror.com/",
"ECMA-262": "https://tc39.es/ecma262/",
"Google": "https://google.com/",
"Hacker News": "https://news.ycombinator.com/",
"NY Times": "https://nytimes.com/",
"Reddit": "https://reddit.com/",
"Twitter": "https://twitter.com/",
"Wikipedia": "https://en.wikipedia.org/wiki/Soil",
};
const fetchTest = async (name, url) => {
const html = await request({
url,
headers: {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; rv:71.0) Gecko/20100101 Firefox/71.0',
},
});
console.log(`Fetched ${name}`);
return [name, html];
};
(async () => {
const existing = await fs.readdir(path.join(__dirname, 'tests'));
await Promise.all(existing.map(e => fs.unlink(path.join(__dirname, 'tests', e))));
// Format after fetching as formatting is synchronous and can take so long that connections get dropped by server due to inactivity.
for (const [name, html] of await Promise.all(Object.entries(tests).map(([name, url]) => fetchTest(name, url)))) {
const formatted = prettier.format(html, {parser: 'html'});
console.log(`Formatted ${name}`);
await fs.writeFile(path.join(__dirname, 'tests', `${name}.html`), formatted);
}
})()
.catch(console.error);

View File

@ -6,7 +6,10 @@
"chartjs-node": "^1.7.1",
"html-minifier": "3.5.19",
"hyperbuild": "file:../nodejs",
"minimize": "2.2.0"
"minimize": "2.2.0",
"prettier": "^1.19.1",
"request": "^2.88.0",
"request-promise-native": "^1.0.8"
},
"scripts": {
"start": "node bench.js"

1
bench/tests/Amazon.html Normal file
View File

@ -0,0 +1 @@
<1F>

3985
bench/tests/Bing.html Normal file

File diff suppressed because it is too large Load Diff

6164
bench/tests/Bootstrap.html Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

270053
bench/tests/ECMA-262.html Normal file

File diff suppressed because it is too large Load Diff

12480
bench/tests/Google.html Normal file

File diff suppressed because it is too large Load Diff

1295
bench/tests/Hacker News.html Normal file

File diff suppressed because it is too large Load Diff

29619
bench/tests/NY Times.html Normal file

File diff suppressed because one or more lines are too long

35379
bench/tests/Reddit.html Normal file

File diff suppressed because it is too large Load Diff

1976
bench/tests/Twitter.html Normal file

File diff suppressed because one or more lines are too long

45821
bench/tests/Wikipedia.html Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -1,508 +0,0 @@
<!doctype html>
<html itemscope="" itemtype="http://schema.org/WebPage" lang="en-NZ">
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
<meta content="/logos/doodles/2018/talal-maddahs-78th-birthday-6602499589931008-l.png" itemprop="image">
<meta content="Talal Maddahs 78th Birthday" property="twitter:title">
<meta content="Talal Maddahs 78th Birthday! #GoogleDoodle" property="twitter:description">
<meta content="Talal Maddahs 78th Birthday! #GoogleDoodle" property="og:description">
<meta content="summary_large_image" property="twitter:card">
<meta content="@GoogleDoodles" property="twitter:site">
<meta content="https://www.google.com/logos/doodles/2018/talal-maddahs-78th-birthday-6602499589931008-2x.png" property="twitter:image">
<meta content="https://www.google.com/logos/doodles/2018/talal-maddahs-78th-birthday-6602499589931008-2x.png" property="og:image">
<meta content="919" property="og:image:width">
<meta content="440" property="og:image:height">
<title>Google</title>
<script nonce="lYBRVu6AiBvzvVYXwtDweQ==">(function () {
window.google = {
kEI: 'k6hlW976BZTM8wWmgYWABQ',
kEXPI: '0,1352961,786,57,1370,284,303,1018,281,837,877,635,195,99,387,50,434,315,34,435,53,2338651,191,236,32,329294,1294,12383,2349,2506,32692,15247,867,6057,635,5471,6381,3335,2,2,4609,2192,369,548,664,326,1776,113,2203,3189,224,1130,1082,136,130,5107,444,131,1119,2,579,727,311,846,1275,58,2,4,1297,1714,1374,507,275,453,377,1719,1294,8,1570,773,1232,883,135,281,2,1124,1701,438,1198,525,621,5,2,2,2299,125,2,65,3,1331,301,434,4,176,283,509,1587,296,1344,69,984,66,334,17,38,75,1110,78,36,120,386,592,419,81,7,3,25,463,243,377,29,707,282,406,451,7,63,568,1194,22,99,429,79,162,441,95,806,2,113,935,235,240,84,30,392,208,49,100,80,152,202,379,103,5,25,2,601,635,178,580,38,79,29,2320646,3685997,1873,681,79,8797707,4,1572,549,332,445,1,2,1,1,77,1,1,900,583,1,312,1,8,1,2,2,112,2018,1,1,1,1,1,47,158,1,13,19,9,9,15,15,10,25,1,1,3,1,1,22309473',
authuser: 0,
kscs: 'c9c918f0_k6hlW976BZTM8wWmgYWABQ',
kGL: 'NZ'
};
google.kHL = 'en-NZ';
})();
google.time = function () {
return (new Date).getTime()
};
(function () {
google.lc = [];
google.li = 0;
google.getEI = function (a) {
for (var b; a && (!a.getAttribute || !(b = a.getAttribute("eid")));) a = a.parentNode;
return b || google.kEI
};
google.getLEI = function (a) {
for (var b = null; a && (!a.getAttribute || !(b = a.getAttribute("leid")));) a = a.parentNode;
return b
};
google.https = function () {
return "https:" == window.location.protocol
};
google.ml = function () {
return null
};
google.wl = function (a, b) {
try {
google.ml(Error(a), !1, b)
} catch (d) {
}
};
google.log = function (a, b, d, c, g) {
if (a = google.logUrl(a, b, d, c, g)) {
b = new Image;
var e = google.lc, f = google.li;
e[f] = b;
b.onerror = b.onload = b.onabort = function () {
delete e[f]
};
google.vel && google.vel.lu && google.vel.lu(a);
b.src = a;
google.li = f + 1
}
};
google.logUrl = function (a, b, d, c, g) {
var e = "", f = google.ls || "";
d || -1 != b.search("&ei=") || (e = "&ei=" + google.getEI(c), -1 == b.search("&lei=") && (c = google.getLEI(c)) && (e += "&lei=" + c));
c = "";
!d && google.cshid && -1 == b.search("&cshid=") && "slh" != a && (c = "&cshid=" + google.cshid);
a = d || "/" + (g || "gen_204") + "?atyp=i&ct=" + a + "&cad=" + b + e + f + "&zx=" + google.time() + c;
/^http:/i.test(a) && google.https() && (google.ml(Error("a"), !1, {src: a, glmm: 1}), a = "");
return a
};
}).call(this);
(function () {
google.y = {};
google.x = function (a, b) {
if (a) var c = a.id; else {
do c = Math.random(); while (google.y[c])
}
google.y[c] = [a, b];
return !1
};
google.lm = [];
google.plm = function (a) {
google.lm.push.apply(google.lm, a)
};
google.lq = [];
google.load = function (a, b, c) {
google.lq.push([[a], b, c])
};
google.loadAll = function (a, b) {
google.lq.push([a, b])
};
}).call(this);
google.f = {};</script>
<script nonce="lYBRVu6AiBvzvVYXwtDweQ==">var a = window.location, b = a.href.indexOf("#");
if (0 <= b) {
var c = a.href.substring(b + 1);
/(^|&)q=/.test(c) && -1 == c.indexOf("#") && a.replace("/search?" + c.replace(/(^|&)fp=[^&]*/g, "") + "&cad=h")
}
;</script>
<style>#gbar, #guser {
font-size: 13px;
padding-top: 1px !important;
}
#gbar {
height: 22px
}
#guser {
padding-bottom: 7px !important;
text-align: right
}
.gbh, .gbd {
border-top: 1px solid #c9d7f1;
font-size: 1px
}
.gbh {
height: 0;
position: absolute;
top: 24px;
width: 100%
}
@media all {
.gb1 {
height: 22px;
margin-right: .5em;
vertical-align: top
}
#gbar {
float: left
}
}
a.gb1, a.gb4 {
text-decoration: underline !important
}
a.gb1, a.gb4 {
color: #00c !important
}
.gbi .gb4 {
color: #dd8e27 !important
}
.gbf .gb4 {
color: #900 !important
}
</style>
<style>body, td, a, p, .h {
font-family: arial, sans-serif
}
body {
margin: 0;
overflow-y: scroll
}
#gog {
padding: 3px 8px 0
}
td {
line-height: .8em
}
.gac_m td {
line-height: 17px
}
form {
margin-bottom: 20px
}
.h {
color: #36c
}
.q {
color: #00c
}
.ts td {
padding: 0
}
.ts {
border-collapse: collapse
}
em {
font-weight: bold;
font-style: normal
}
.lst {
height: 25px;
width: 496px
}
.gsfi, .lst {
font: 18px arial, sans-serif
}
.gsfs {
font: 17px arial, sans-serif
}
.ds {
display: inline-box;
display: inline-block;
margin: 3px 0 4px;
margin-left: 4px
}
input {
font-family: inherit
}
a.gb1, a.gb2, a.gb3, a.gb4 {
color: #11c !important
}
body {
background: #fff;
color: black
}
a {
color: #11c;
text-decoration: none
}
a:hover, a:active {
text-decoration: underline
}
.fl a {
color: #36c
}
a:visited {
color: #551a8b
}
a.gb1, a.gb4 {
text-decoration: underline
}
a.gb3:hover {
text-decoration: none
}
#ghead a.gb2:hover {
color: #fff !important
}
.sblc {
padding-top: 5px
}
.sblc a {
display: block;
margin: 2px 0;
margin-left: 13px;
font-size: 11px
}
.lsbb {
background: #eee;
border: solid 1px;
border-color: #ccc #999 #999 #ccc;
height: 30px
}
.lsbb {
display: block
}
.ftl, #fll a {
display: inline-block;
margin: 0 12px
}
.lsb {
background: url(/images/nav_logo229.png) 0 -261px repeat-x;
border: none;
color: #000;
cursor: pointer;
height: 30px;
margin: 0;
outline: 0;
font: 15px arial, sans-serif;
vertical-align: top
}
.lsb:active {
background: #ccc
}
.lst:focus {
outline: none
}</style>
<script nonce="lYBRVu6AiBvzvVYXwtDweQ=="></script>
<link href="/images/branding/product/ico/googleg_lodp.ico" rel="shortcut icon">
</head>
<body bgcolor="#fff">
<script nonce="lYBRVu6AiBvzvVYXwtDweQ==">(function () {
var src = '/images/nav_logo229.png';
var iesg = false;
document.body.onload = function () {
window.n && window.n();
if (document.images) {
new Image().src = src;
}
if (!iesg) {
document.f && document.f.q.focus();
document.gbqf && document.gbqf.q.focus();
}
}
})();</script>
<div id="mngb">
<div id="gbar">
<nobr><b class="gb1">Search</b> <a class="gb1" href="https://www.google.co.nz/imghp?hl=en&amp;tab=wi">Images</a> <a class="gb1"
href="https://maps.google.co.nz/maps?hl=en&amp;tab=wl">Maps</a>
<a class="gb1" href="https://play.google.com/?hl=en&amp;tab=w8">Play</a> <a class="gb1" href="https://www.youtube.com/?gl=NZ&amp;tab=w1">YouTube</a>
<a class="gb1" href="https://news.google.co.nz/nwshp?hl=en&amp;tab=wn">News</a> <a class="gb1"
href="https://mail.google.com/mail/?tab=wm">Gmail</a>
<a class="gb1" href="https://drive.google.com/?tab=wo">Drive</a> <a class="gb1" style="text-decoration:none"
href="https://www.google.co.nz/intl/en/options/"><u>More</u>
»</a></nobr>
</div>
<div id="guser" width="100%">
<nobr><span id="gbn" class="gbi"></span><span id="gbf" class="gbf"></span><span id="gbe"></span><a
href="http://www.google.co.nz/history/optout?hl=en" class="gb4">Web History</a> | <a href="/preferences?hl=en"
class="gb4">Settings</a> | <a target="_top"
id="gb_70"
href="https://accounts.google.com/ServiceLogin?hl=en&amp;passive=true&amp;continue=https://www.google.com/"
class="gb4">Sign
in</a></nobr>
</div>
<div class="gbh" style="left:0"></div>
<div class="gbh" style="right:0"></div>
</div>
<center><br id="lgpd" clear="all">
<div id="lga"><a
href="/search?site=&amp;ie=UTF-8&amp;q=Talal+Maddah&amp;oi=ddle&amp;ct=talal-maddahs-78th-birthday-6602499589931008-l&amp;hl=en&amp;kgmid=/m/03d4wst&amp;sa=X&amp;ved=0ahUKEwiekPr7vtPcAhUU5rwKHaZAAVAQPQgD"><img
alt="Talal Maddahs 78th Birthday" src="/logos/doodles/2018/talal-maddahs-78th-birthday-6602499589931008-l.png"
title="Talal Maddahs 78th Birthday" id="hplogo" onload="window.lol&amp;&amp;amplol()" width="460" height="220" border="0"><br></a><br>
</div>
<form action="/search" name="f">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr valign="top">
<td width="25%">&nbsp;</td>
<td nowrap="" align="center"><input name="ie" value="ISO-8859-1" type="hidden"><input value="en-NZ" name="hl" type="hidden"><input
name="source" type="hidden" value="hp"><input name="biw" type="hidden"><input name="bih" type="hidden">
<div class="ds" style="height:32px;margin:4px 0"><input style="color:#000;margin:0;padding:5px 8px 0 6px;vertical-align:top"
autocomplete="off" class="lst" value="" title="Google Search"
maxlength="2048" name="q" size="57"></div>
<br style="line-height:0"><span class="ds"><span class="lsbb"><input class="lsb" value="Google Search" name="btnG" type="submit"></span></span><span
class="ds"><span class="lsbb"><input class="lsb" value="I'm Feeling Lucky" name="btnI"
onclick="if(this.form.q.value)this.checked=1; else top.location='/doodles/'"
type="submit"></span></span></td>
<td class="fl sblc" width="25%" nowrap="" align="left"><a href="/advanced_search?hl=en-NZ&amp;authuser=0">Advanced search</a><a
href="/language_tools?hl=en-NZ&amp;authuser=0">Language tools</a></td>
</tr>
</tbody>
</table>
<input id="gbv" name="gbv" type="hidden" value="1"></form>
<div id="gac_scont"></div>
<div style="font-size:83%;min-height:3.5em"><br>
<div id="gws-output-pages-elements-homepage_additional_languages__als">
<style>#gws-output-pages-elements-homepage_additional_languages__als {
font-size: small;
margin-bottom: 24px
}
#SIvCob {
display: inline-block;
line-height: 28px;
}
#SIvCob a {
padding: 0 3px;
}
.H6sW5 {
display: inline-block;
margin: 0 2px;
white-space: nowrap
}
.z4hgWe {
display: inline-block;
margin: 0 2px
}</style>
<div id="SIvCob">Google offered in: <a
href="https://www.google.com/setprefs?sig=0_3YU-IUa_nnzYuft4VA71QXbco8g%3D&amp;hl=mi&amp;source=homepage&amp;sa=X&amp;ved=0ahUKEwiekPr7vtPcAhUU5rwKHaZAAVAQ2ZgBCAU">Māori</a>
</div>
</div>
</div>
<span id="footer"><div style="font-size:10pt"><div style="margin:19px auto;text-align:center" id="fll"><a href="/intl/en/ads/">Advertising<EFBFBD>Programs</a><a
href="/services/">Business Solutions</a><a href="/intl/en/about.html">About Google</a><a
href="https://www.google.com/setprefdomain?prefdom=NZ&amp;prev=https://www.google.co.nz/&amp;sig=__Np33X__SnOfe3W0vIXZ_4g2ck2M%3D">Google.co.nz</a></div></div><p
style="color:#767676;font-size:8pt">© 2018 - <a href="/intl/en/policies/privacy/">Privacy</a> - <a
href="/intl/en/policies/terms/">Terms</a></p></span>
</center>
<script nonce="lYBRVu6AiBvzvVYXwtDweQ==">(function () {
window.google.cdo = {height: 0, width: 0};
(function () {
var a = window.innerWidth, b = window.innerHeight;
if (!a || !b) {
var c = window.document, d = "CSS1Compat" == c.compatMode ? c.documentElement : c.body;
a = d.clientWidth;
b = d.clientHeight
}
a && b && (a != google.cdo.width || b != google.cdo.height) && google.log("", "", "/client_204?&atyp=i&biw=" + a + "&bih=" + b + "&ei=" + google.kEI);
}).call(this);
})();</script>
<div id="xjsd">
<script src="/xjs/_/js/k=xjs.hp.en.9bv7OYgIqhU.O/m=sb_he,d/am=hIKxAQ/rt=j/d=1/rs=ACT90oFTVp75vV7ieET8xfYa7BARQt4ovA"></script>
</div>
<div id="xjsi">
<script nonce="lYBRVu6AiBvzvVYXwtDweQ==">(function () {
function c(b) {
window.setTimeout(function () {
var a = document.createElement("script");
a.src = b;
google.timers && google.timers.load.t && google.tick && google.tick("load", {gen204: "xjsls", clearcut: 31});
document.getElementById("xjsd").appendChild(a)
}, 0)
}
google.dljp = function (b, a) {
google.xjsu = b;
c(a)
};
google.dlj = c;
}).call(this);
if (!google.xjs) {
window._ = window._ || {};
window._DumpException = window._._DumpException = function (e) {
throw e
};
window._F_installCss = window._._F_installCss = function (c) {
};
google.dljp('/xjs/_/js/k\x3dxjs.hp.en.9bv7OYgIqhU.O/m\x3dsb_he,d/am\x3dhIKxAQ/rt\x3dj/d\x3d1/rs\x3dACT90oFTVp75vV7ieET8xfYa7BARQt4ovA', '/xjs/_/js/k\x3dxjs.hp.en.9bv7OYgIqhU.O/m\x3dsb_he,d/am\x3dhIKxAQ/rt\x3dj/d\x3d1/rs\x3dACT90oFTVp75vV7ieET8xfYa7BARQt4ovA');
google.xjs = 1;
}
google.pmc = {
"sb_he": {
"agen": true,
"cgen": true,
"client": "heirloom-hp",
"dh": true,
"dhqt": true,
"ds": "",
"ffql": "en",
"fl": true,
"host": "google.com",
"isbh": 28,
"jsonp": true,
"msgs": {
"cibl": "Clear Search",
"dym": "Did you mean:",
"lcky": "I\u0026#39;m Feeling Lucky",
"lml": "Learn more",
"oskt": "Input tools",
"psrc": "This search was removed from your \u003Ca href=\"/history\"\u003EWeb History\u003C/a\u003E",
"psrl": "Remove",
"sbit": "Search by image",
"srch": "Google Search"
},
"nds": true,
"ovr": {},
"pq": "",
"refpd": true,
"rfs": [],
"sbpl": 24,
"sbpr": 24,
"scd": 10,
"sce": 5,
"stok": "qbUiFV1JY4w5qCcvufP0RMs3UGY"
}, "d": {}, "ZI/YVQ": {}, "Qnk92g": {}, "U5B21g": {}, "DPBNMg": {}, "YFCs/g": {}
};
google.x(null, function () {
});
(function () {
var r = [];
google.plm(r);
})();
(function () {
var m = []
;google.jsc && google.jsc.m(m);
})();</script>
</div>
</body>
</html>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -9,7 +9,7 @@ const BOOLEAN_ATTRS_PATH = path.join(__dirname, '..', 'boolean_attrs.json');
const REACT_TYPINGS_URL = 'https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/master/types/react/index.d.ts';
const REACT_TYPINGS_FILE = path.join(__dirname, 'react.d.ts');
const get_react_typings_source = async () => {
const fetchReactTypingsSource = async () => {
try {
return await fs.readFile(REACT_TYPINGS_FILE, "utf8");
} catch (err) {
@ -72,6 +72,6 @@ const processReactTypeDeclarations = async (source) => {
};
(async () => {
const source = ts.createSourceFile(`react.d.ts`, await get_react_typings_source(), ts.ScriptTarget.ES2019);
const source = ts.createSourceFile(`react.d.ts`, await fetchReactTypingsSource(), ts.ScriptTarget.ES2019);
await processReactTypeDeclarations(source);
})();