current commit
260828.1 · ffi: enable module by default
'use strict';

const common = require('../common.js');
const ffi = require('node:ffi');

const bench = common.createBenchmark(main, {
  n: [1e7],
});

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();
}