Skip to content

Commit f394e11

Browse files
committed
fixup! src,lib: initial ffi implementation
1 parent 8d87576 commit f394e11

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

benchmark/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ directory, see [the guide on benchmarks](../doc/contributing/writing-and-running
2525
| es | Benchmarks for various new ECMAScript features and their pre-ES2015 counterparts. |
2626
| events | Benchmarks for the `events` subsystem. |
2727
| fixtures | Benchmarks fixtures used in various benchmarks throughout the benchmark suite. |
28+
| ffi | Benchmarks for the `ffi` subsystem. |
2829
| fs | Benchmarks for the `fs` subsystem. |
2930
| http | Benchmarks for the `http` subsystem. |
3031
| http2 | Benchmarks for the `http2` subsystem. |

benchmark/ffi/getpid.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
'use strict';
2+
3+
const common = require('../common.js');
4+
const ffi = require('node:ffi');
5+
6+
const bench = common.createBenchmark(main, {
7+
n: [1e7]
8+
})
9+
10+
const getpid = ffi.getNativeFunction(null, 'uv_os_getpid', 'int', []);
11+
12+
function main({ n }) {
13+
bench.start();
14+
for (let i = 0; i < n; ++i)
15+
getpid();
16+
bench.end(n);
17+
18+
}

0 commit comments

Comments
 (0)