MCPcopy Index your code
hub / github.com/nodejs/node / measureSubtle

Function measureSubtle

benchmark/crypto/webcrypto-digest.js:35–45  ·  view source on GitHub ↗
(n, data, method)

Source from the content-addressed store, hash-verified

33}
34
35function measureSubtle(n, data, method) {
36 const ec = new TextEncoder();
37 data = ec.encode(data);
38 const jobs = new Array(n);
39 bench.start();
40 for (let i = 0; i < n; i++)
41 jobs[i] = subtle.digest(method, data);
42 Promise.all(jobs).then(() => bench.end(n)).catch((err) => {
43 process.nextTick(() => { throw err; });
44 });
45}
46
47function main({ n, sync, data, method }) {
48 data = globalThis.crypto.getRandomValues(Buffer.alloc(data));

Callers 1

mainFunction · 0.85

Calls 5

encodeMethod · 0.95
allMethod · 0.80
startMethod · 0.45
thenMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…