mirror of
https://github.com/nodejs/node.git
synced 2025-08-15 13:48:44 +02:00
benchmark: add trailing commas in benchmark/crypto
PR-URL: https://github.com/nodejs/node/pull/46553 Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Akhil Marsonya <akhil.marsonya27@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com>
This commit is contained in:
parent
3aef395ed5
commit
214b00d215
13 changed files with 19 additions and 20 deletions
|
@ -9,7 +9,6 @@ rules:
|
|||
|
||||
overrides:
|
||||
- files:
|
||||
- crypto/*.js
|
||||
- http/*.js
|
||||
- path/*.js
|
||||
rules:
|
||||
|
|
|
@ -5,7 +5,7 @@ const keylen = { 'aes-128-gcm': 16, 'aes-192-gcm': 24, 'aes-256-gcm': 32 };
|
|||
const bench = common.createBenchmark(main, {
|
||||
n: [500],
|
||||
cipher: ['aes-128-gcm', 'aes-192-gcm', 'aes-256-gcm'],
|
||||
len: [1024, 4 * 1024, 16 * 1024, 64 * 1024, 256 * 1024, 1024 * 1024]
|
||||
len: [1024, 4 * 1024, 16 * 1024, 64 * 1024, 256 * 1024, 1024 * 1024],
|
||||
});
|
||||
|
||||
function main({ n, len, cipher }) {
|
||||
|
|
|
@ -6,9 +6,9 @@ const bench = common.createBenchmark(main, {
|
|||
cipher: ['AES192', 'AES256'],
|
||||
type: ['asc', 'utf', 'buf'],
|
||||
len: [2, 1024, 102400, 1024 * 1024],
|
||||
api: ['legacy', 'stream']
|
||||
api: ['legacy', 'stream'],
|
||||
}, {
|
||||
flags: ['--no-warnings']
|
||||
flags: ['--no-warnings'],
|
||||
});
|
||||
|
||||
function main({ api, cipher, type, len, writes }) {
|
||||
|
|
|
@ -4,7 +4,7 @@ const common = require('../common.js');
|
|||
|
||||
const bench = common.createBenchmark(main, {
|
||||
n: [1, 5000],
|
||||
v: ['crypto', 'tls']
|
||||
v: ['crypto', 'tls'],
|
||||
});
|
||||
|
||||
function main({ n, v }) {
|
||||
|
|
|
@ -10,7 +10,7 @@ const bench = common.createBenchmark(main, {
|
|||
type: ['asc', 'utf', 'buf'],
|
||||
out: ['hex', 'binary', 'buffer'],
|
||||
len: [2, 1024, 102400, 1024 * 1024],
|
||||
api: ['legacy', 'stream']
|
||||
api: ['legacy', 'stream'],
|
||||
});
|
||||
|
||||
function main({ api, type, len, out, writes, algo }) {
|
||||
|
|
|
@ -9,7 +9,7 @@ const bench = common.createBenchmark(main, {
|
|||
algo: ['sha1', 'sha256', 'sha512'],
|
||||
type: ['asc', 'utf', 'buf'],
|
||||
len: [2, 1024, 102400, 1024 * 1024],
|
||||
api: ['legacy', 'stream']
|
||||
api: ['legacy', 'stream'],
|
||||
});
|
||||
|
||||
function main({ api, type, len, algo, writes }) {
|
||||
|
|
|
@ -4,7 +4,7 @@ const common = require('../common.js');
|
|||
const assert = require('assert');
|
||||
const {
|
||||
hkdf,
|
||||
hkdfSync
|
||||
hkdfSync,
|
||||
} = require('crypto');
|
||||
|
||||
const bench = common.createBenchmark(main, {
|
||||
|
|
|
@ -4,7 +4,7 @@ const common = require('../common.js');
|
|||
const assert = require('assert');
|
||||
const {
|
||||
generateKeyPair,
|
||||
generateKeyPairSync
|
||||
generateKeyPairSync,
|
||||
} = require('crypto');
|
||||
|
||||
const bench = common.createBenchmark(main, {
|
||||
|
@ -18,7 +18,7 @@ const methods = {
|
|||
for (let i = 0; i < n; ++i) {
|
||||
generateKeyPairSync('rsa', {
|
||||
modulusLength: 1024,
|
||||
publicExponent: 0x10001
|
||||
publicExponent: 0x10001,
|
||||
});
|
||||
}
|
||||
bench.end(n);
|
||||
|
@ -35,7 +35,7 @@ const methods = {
|
|||
for (let i = 0; i < n; ++i)
|
||||
generateKeyPair('rsa', {
|
||||
modulusLength: 512,
|
||||
publicExponent: 0x10001
|
||||
publicExponent: 0x10001,
|
||||
}, done);
|
||||
},
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ const keyFixtures = {
|
|||
publicKey: fs.readFileSync(`${fixtures_keydir}/ec_p256_public.pem`)
|
||||
.toString(),
|
||||
privateKey: fs.readFileSync(`${fixtures_keydir}/ec_p256_private.pem`)
|
||||
.toString()
|
||||
.toString(),
|
||||
};
|
||||
|
||||
const data = crypto.randomBytes(256);
|
||||
|
@ -20,7 +20,7 @@ let keyObjects;
|
|||
function getKeyObject({ privateKey, publicKey }) {
|
||||
return {
|
||||
privateKey: crypto.createPrivateKey(privateKey),
|
||||
publicKey: crypto.createPublicKey(publicKey)
|
||||
publicKey: crypto.createPublicKey(publicKey),
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -60,7 +60,7 @@ function measureAsyncSerial(n, privateKey, publicKey, keys) {
|
|||
data,
|
||||
{
|
||||
key: privateKey || keys[n - remaining].privateKey,
|
||||
dsaEncoding: 'ieee-p1363'
|
||||
dsaEncoding: 'ieee-p1363',
|
||||
},
|
||||
(err, signature) => {
|
||||
crypto.verify(
|
||||
|
@ -68,7 +68,7 @@ function measureAsyncSerial(n, privateKey, publicKey, keys) {
|
|||
data,
|
||||
{
|
||||
key: publicKey || keys[n - remaining].publicKey,
|
||||
dsaEncoding: 'ieee-p1363'
|
||||
dsaEncoding: 'ieee-p1363',
|
||||
},
|
||||
signature,
|
||||
done);
|
||||
|
@ -104,7 +104,7 @@ function measureAsyncParallel(n, privateKey, publicKey, keys) {
|
|||
function main({ n, mode, keyFormat }) {
|
||||
pems ||= [...Buffer.alloc(n)].map(() => ({
|
||||
privateKey: keyFixtures.privateKey,
|
||||
publicKey: keyFixtures.publicKey
|
||||
publicKey: keyFixtures.publicKey,
|
||||
}));
|
||||
keyObjects ||= pems.map(getKeyObject);
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ const bench = common.createBenchmark(main, {
|
|||
mode: ['sync', 'async-sequential', 'async-parallel'],
|
||||
min: [-(2 ** 47) + 1, -10_000, -100],
|
||||
max: [100, 10_000, 2 ** 47],
|
||||
n: [1e3, 1e5]
|
||||
n: [1e3, 1e5],
|
||||
});
|
||||
|
||||
function main({ mode, min, max, n }) {
|
||||
|
|
|
@ -19,7 +19,7 @@ keylen_list.forEach((key) => {
|
|||
const bench = common.createBenchmark(main, {
|
||||
n: [500],
|
||||
keylen: keylen_list,
|
||||
len: [16, 32, 64]
|
||||
len: [16, 32, 64],
|
||||
});
|
||||
|
||||
function main({ len, algo, keylen, n }) {
|
||||
|
|
|
@ -20,7 +20,7 @@ const bench = common.createBenchmark(main, {
|
|||
writes: [500],
|
||||
algo: ['SHA1', 'SHA224', 'SHA256', 'SHA384', 'SHA512'],
|
||||
keylen: keylen_list,
|
||||
len: [1024, 102400, 2 * 102400, 3 * 102400, 1024 * 1024]
|
||||
len: [1024, 102400, 2 * 102400, 3 * 102400, 1024 * 1024],
|
||||
});
|
||||
|
||||
function main({ len, algo, keylen, writes }) {
|
||||
|
|
|
@ -15,7 +15,7 @@ const kMethods = {
|
|||
'SHA-1': 'sha1',
|
||||
'SHA-256': 'sha256',
|
||||
'SHA-384': 'sha384',
|
||||
'SHA-512': 'sha512'
|
||||
'SHA-512': 'sha512',
|
||||
};
|
||||
|
||||
// This benchmark only looks at clock time and ignores factors
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue