Follow-up to df09b2a48c.
Refs: https://github.com/nodejs/node/pull/63482
Signed-off-by: Anna Henningsen <anna@addaleax.net>
PR-URL: https://github.com/nodejs/node/pull/63666
Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
25 lines
448 B
JavaScript
25 lines
448 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common.js');
|
|
const ffi = require('node:ffi');
|
|
|
|
const bench = common.createBenchmark(main, {
|
|
n: [1e7],
|
|
}, {
|
|
flags: ['--experimental-ffi'],
|
|
});
|
|
|
|
const { lib, functions } = ffi.dlopen(null, {
|
|
uv_os_getpid: { return: 'i32', arguments: [] },
|
|
});
|
|
|
|
const getpid = functions.uv_os_getpid;
|
|
|
|
function main({ n }) {
|
|
bench.start();
|
|
for (let i = 0; i < n; ++i)
|
|
getpid();
|
|
bench.end(n);
|
|
|
|
lib.close();
|
|
}
|