-
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
9 changed files
with
233 additions
and
2 deletions.
There are no files selected for viewing
Binary file not shown.
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,9 @@ | ||
import cheerio from "./cheerio.mjs"; | ||
import niddle from "./niddle.mjs"; | ||
|
||
async function main() { | ||
await niddle(); | ||
await cheerio(); | ||
} | ||
|
||
main(); |
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,26 @@ | ||
import { load } from "cheerio"; | ||
import benchmark from "htmlparser-benchmark"; | ||
|
||
export default function cheerio() { | ||
return new Promise((res) => { | ||
var bench = benchmark(function (html, callback) { | ||
const $ = load(html); | ||
$.html(); | ||
callback(); | ||
}); | ||
|
||
bench.on("progress", function (key) { | ||
// console.log('finished parsing ' + key + '.html'); | ||
}); | ||
|
||
bench.on("result", function (stat) { | ||
console.log( | ||
"cheerio :" + | ||
stat.mean().toPrecision(6) + | ||
" ms/file ± " + | ||
stat.sd().toPrecision(6), | ||
); | ||
res(); | ||
}); | ||
}); | ||
} |
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,26 @@ | ||
import * as niddle from "../index.js"; | ||
import benchmark from "htmlparser-benchmark"; | ||
|
||
export default function cheerio() { | ||
return new Promise((res) => { | ||
var bench = benchmark(function (html, callback) { | ||
const $ = niddle.parse(html); | ||
$.outerHtml(); | ||
callback(); | ||
}); | ||
|
||
bench.on("progress", function (key) { | ||
// console.log('finished parsing ' + key + '.html'); | ||
}); | ||
|
||
bench.on("result", function (stat) { | ||
console.log( | ||
"niddle :" + | ||
stat.mean().toPrecision(6) + | ||
" ms/file ± " + | ||
stat.sd().toPrecision(6), | ||
); | ||
res(); | ||
}); | ||
}); | ||
} |
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
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