-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathperf.js
37 lines (30 loc) · 794 Bytes
/
perf.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
'use strict';
const fs = require('fs');
const jsdom = require('jsdom').jsdom;
const juice = require('juice');
const cheerio = require('cheerio');
const scopeifyHtml = require('./index');
const fixtures = [
'zillow.html',
'gog.html',
'readme_ex.html',
'apple.html',
'costco.html',
'sentry.html',
];
fixtures.forEach(fname => {
const html = fs.readFileSync(`./fixtures/${fname}`);
const htmlStr = html.toString();
console.log('---');
const scopeifyId = `scopeify-html ${fname}`;
const doc = jsdom(html);
console.time(scopeifyId);
scopeifyHtml().sync(doc);
console.timeEnd(scopeifyId);
const juiceId = `juice ${fname}`;
const $ = cheerio.load(htmlStr);
console.time(juiceId);
juice.juiceDocument($);
console.timeEnd(juiceId);
console.log('---');
});