napi-rs/bench/create-array.ts
2021-05-17 11:42:57 +08:00

25 lines
475 B
TypeScript

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(),
)