benchmark: remove duplicate ffi string length direct

Signed-off-by: HoonDongKang <d159123@naver.com>
PR-URL: https://github.com/nodejs/node/pull/66278
Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
Donghoon Kang authored and GitHub committed 2026-09-27 12:05:50 +00:00
1 parent 3641c36af1
commit c97bbfb2e7
2 files changed
-28

No files matched your search

@@ -1,28 +0,0 @@
'use strict';
const common = require('../common.js');
const ffi = require('node:ffi');
const { libraryPath, ensureFixtureLibrary } = require('./common.js');
const bench = common.createBenchmark(main, {
n: [1e7],
});
ensureFixtureLibrary();
const { lib, functions } = ffi.dlopen(libraryPath, {
string_length: { return: 'u64', arguments: ['pointer'] },
});
const fn = functions.string_length;
const string = Buffer.from('hello\0');
const pointer = ffi.getRawPointer(string);
function main({ n }) {
bench.start();
for (let i = 0; i < n; ++i)
fn(pointer);
bench.end(n);
lib.close();
}