|
|
|
@ -1,12 +1,36 @@
|
|
|
|
|
var getTestPages = require("./test/bootstrap").getTestPages;
|
|
|
|
|
|
|
|
|
|
var readability = require("./index.js");
|
|
|
|
|
var Readability = readability.Readability;
|
|
|
|
|
var JSDOMParser = readability.JSDOMParser;
|
|
|
|
|
|
|
|
|
|
suite("Readability test suite benchmarks", function () {
|
|
|
|
|
set("iterations", 100);
|
|
|
|
|
var referenceTestPages = [
|
|
|
|
|
"002",
|
|
|
|
|
"herald-sun-1",
|
|
|
|
|
"lifehacker-working",
|
|
|
|
|
"lifehacker-post-comment-load",
|
|
|
|
|
"medium-1",
|
|
|
|
|
"medium-2",
|
|
|
|
|
"salon-1",
|
|
|
|
|
"tmz-1",
|
|
|
|
|
"wapo-1",
|
|
|
|
|
"wapo-2",
|
|
|
|
|
"webmd-1",
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
var testPages = getTestPages();
|
|
|
|
|
|
|
|
|
|
if (process.env.READABILITY_PERF_REFERENCE === "1") {
|
|
|
|
|
testPages = testPages.filter(function(testPage) {
|
|
|
|
|
return referenceTestPages.indexOf(testPage.dir) !== -1;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
suite("Readability test page perf", function () {
|
|
|
|
|
set("iterations", 1);
|
|
|
|
|
set("type", "static");
|
|
|
|
|
|
|
|
|
|
require("./test/bootstrap").getTestPages().forEach(function(testPage) {
|
|
|
|
|
testPages.forEach(function(testPage) {
|
|
|
|
|
bench(testPage.dir + " perf", function() {
|
|
|
|
|
new JSDOMParser().parse(testPage.source);
|
|
|
|
|
});
|
|
|
|
|