diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-21 20:56:19 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-21 20:56:19 +0000 |
commit | 0b6210cd37b68b94252cb798598b12974a20e1c1 (patch) | |
tree | e371686554a877842d95aa94f100bee552ff2a8e /fastify-busboy/bench/parse-params.js | |
parent | Initial commit. (diff) | |
download | node-undici-upstream.tar.xz node-undici-upstream.zip |
Adding upstream version 5.28.2+dfsg1+~cs23.11.12.3.upstream/5.28.2+dfsg1+_cs23.11.12.3upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'fastify-busboy/bench/parse-params.js')
-rw-r--r-- | fastify-busboy/bench/parse-params.js | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/fastify-busboy/bench/parse-params.js b/fastify-busboy/bench/parse-params.js new file mode 100644 index 0000000..439a372 --- /dev/null +++ b/fastify-busboy/bench/parse-params.js @@ -0,0 +1,21 @@ +'use strict' + +const parseParams = require('../lib/utils/parseParams') +const { Bench } = require('tinybench'); +const bench = new Bench(); + +const simple = 'video/ogg' +const complex = "'text/plain; filename*=utf-8''%c2%a3%20and%20%e2%82%ac%20rates'" + +bench + .add(simple, function () { parseParams(simple) }) + .add(complex, function () { parseParams(complex) }) + .run() + .then((tasks) => { + const errors = tasks.map(t => t.result?.error).filter((t) => t) + if (errors.length) { + errors.map((e) => console.error(e)) + } else { + console.table(bench.table()) + } + }) |