Skip to content

Commit

Permalink
fixup! src,lib: initial ffi implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
bengl committed Mar 4, 2023
1 parent 8d87576 commit f394e11
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions benchmark/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ directory, see [the guide on benchmarks](../doc/contributing/writing-and-running
| es | Benchmarks for various new ECMAScript features and their pre-ES2015 counterparts. |
| events | Benchmarks for the `events` subsystem. |
| fixtures | Benchmarks fixtures used in various benchmarks throughout the benchmark suite. |
| ffi | Benchmarks for the `ffi` subsystem. |
| fs | Benchmarks for the `fs` subsystem. |
| http | Benchmarks for the `http` subsystem. |
| http2 | Benchmarks for the `http2` subsystem. |
Expand Down
18 changes: 18 additions & 0 deletions benchmark/ffi/getpid.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
'use strict';

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

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

const getpid = ffi.getNativeFunction(null, 'uv_os_getpid', 'int', []);

function main({ n }) {
bench.start();
for (let i = 0; i < n; ++i)
getpid();
bench.end(n);

}

0 comments on commit f394e11

Please sign in to comment.