napi-rs/bench/create-array.ts

26 lines
475 B
TypeScript
Raw Permalink Normal View History

2021-05-14 00:36:39 +09:00
import b from 'benny'
const {
createArrayJson,
createArray,
createArrayWithSerdeTrait,
} = require('./index.node')
export const benchCreateArray = () =>
b.suite(
'createArray',
b.add('createArrayJson', () => {
JSON.parse(createArrayJson())
}),
b.add('create array for loop', () => {
createArray()
}),
b.add('create array with serde trait', () => {
createArrayWithSerdeTrait()
}),
b.cycle(),
b.complete(),
)