/
githubmirror
/
node
Обзор
Документация
Войти
/
githubmirror
/
node
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
benchmark/ffi/string-equals-hello-buffer.js
29 строк
608 B
Paolo Insogna
ffi: add experimental fast FFI call API for AArch64 and x86_64
16 июн 2026, 12:35
Не верифицирован
16 июн 2026, 12:35
3e55527
Код
Авторство
О чём код?
'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], }, { flags: ['--experimental-ffi'], }); ensureFixtureLibrary(); const { lib, functions } = ffi.dlopen(libraryPath, { string_equals_hello: { return: 'u8', arguments: ['buffer'] }, }); const fn = functions.string_equals_hello; const string = Buffer.from('hello\0'); function main({ n }) { bench.start(); for (let i = 0; i < n; ++i) fn(string); bench.end(n); lib.close(); }