/
githubmirror
/
node
Обзор
Документация
Войти
/
githubmirror
/
node
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
benchmark/napi/create_object_with_properties/index.js
24 строки
564 B
Miguel Marcondes Filho
node-api: add napi_create_object_with_properties
30 окт 2025, 17:10
Не верифицирован
30 окт 2025, 17:10
a556db4
Код
Авторство
О чём код?
'use strict'; const common = require('../../common.js'); let binding; try { binding = require(`./build/${common.buildType}/binding`); } catch { console.error(`${__filename}: Binding failed to load`); process.exit(0); } const bench = common.createBenchmark(main, { n: [1e2, 1e3, 1e4, 1e5, 1e6], method: ['new', 'old'], }); function main({ n, method }) { if (method === 'new') { binding.createObjectWithPropertiesNew(n, bench, bench.start, bench.end); } else { binding.createObjectWithPropertiesOld(n, bench, bench.start, bench.end); } }