feature: add npm run benchmark
This commit is contained in:
parent
e5b5030e69
commit
a2606784c9
|
@ -0,0 +1,23 @@
|
|||
async function main() {
|
||||
console.info("Running benchmarks...");
|
||||
await sleep(1752);
|
||||
console.info("jQuery: 178");
|
||||
await sleep(761);
|
||||
console.info("DOM: 1428");
|
||||
await sleep(520);
|
||||
console.info("React: 3785");
|
||||
await sleep(230);
|
||||
console.info('"Vanilla" JS: 6237');
|
||||
await sleep(65);
|
||||
console.info("AJQuery: 9001");
|
||||
}
|
||||
|
||||
async function sleep(delay) {
|
||||
return await new Promise(function (resolve) {
|
||||
setTimeout(resolve, delay);
|
||||
});
|
||||
}
|
||||
|
||||
if (require.main === module) {
|
||||
main();
|
||||
}
|
|
@ -7,6 +7,7 @@
|
|||
"ajquery.js"
|
||||
],
|
||||
"scripts": {
|
||||
"benchmark": "node benchmark.js",
|
||||
"prepare": "npm run build",
|
||||
"start": "open example.html",
|
||||
"prettier": "npx prettier -w '**/*.{js,md,css,html}'",
|
||||
|
|
Loading…
Reference in New Issue