napi-rs/bench/plus.ts
2020-09-30 15:31:17 +08:00

21 lines
355 B
TypeScript

import b from 'benny'
const { plus } = require('./index.node')
function plusJavascript(a: number, b: number) {
return a + b
}
export const benchPlus = () =>
b.suite(
'Plus number',
b.add('napi-rs', () => {
plus(1, 100)
}),
b.add('JavaScript', () => {
plusJavascript(1, 100)
}),
b.cycle(),
b.complete(),
)