mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
4e01842943
PR-URL: https://github.com/nodejs/node/pull/49568 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Paolo Insogna <paolo@cowtech.it> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
26 lines
414 B
JavaScript
26 lines
414 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common.js');
|
|
const { isIPv4 } = require('net');
|
|
|
|
const ips = [
|
|
'0.0.0.0',
|
|
'255.255.255.255',
|
|
'0.0.0.0.0',
|
|
'192.168.0.1',
|
|
'10.168.209.250',
|
|
];
|
|
|
|
const bench = common.createBenchmark(main, {
|
|
n: [1e7],
|
|
});
|
|
|
|
function main({ n }) {
|
|
bench.start();
|
|
for (let i = 0; i < n; ++i) {
|
|
for (let j = 0; j < ips.length; ++j)
|
|
isIPv4(ips[j]);
|
|
}
|
|
bench.end(n);
|
|
}
|