diff options
author | James M Snell <jasnell@gmail.com> | 2021-01-02 08:59:44 +0300 |
---|---|---|
committer | root <root@DESKTOP-5KK9VIR.localdomain> | 2021-01-07 23:44:36 +0300 |
commit | 0008a675ff1c56e736103b0095868dcba8efdce5 (patch) | |
tree | 4225f9c12c0f6ab28d58d95f454ad731ebc6c380 /benchmark | |
parent | 9ff555b7a25c03e330c6f4c93b022b1d5d5d9351 (diff) |
crypto: implement randomuuid
Signed-off-by: James M Snell <jasnell@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/36729
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Ben Coe <bencoe@gmail.com>
Diffstat (limited to 'benchmark')
-rw-r--r-- | benchmark/crypto/randomUUID.js | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/benchmark/crypto/randomUUID.js b/benchmark/crypto/randomUUID.js new file mode 100644 index 00000000000..cca05242874 --- /dev/null +++ b/benchmark/crypto/randomUUID.js @@ -0,0 +1,17 @@ +'use strict'; + +const common = require('../common.js'); +const { randomUUID } = require('crypto'); + +const bench = common.createBenchmark(main, { + n: [1e7], + disableEntropyCache: [0, 1], +}); + +function main({ n, disableEntropyCache }) { + disableEntropyCache = !!disableEntropyCache; + bench.start(); + for (let i = 0; i < n; ++i) + randomUUID({ disableEntropyCache }); + bench.end(n); +} |