2021-06-03 00:03:47 +09:00
|
|
|
import b from 'benny'
|
|
|
|
|
|
|
|
const { query, engine } = require('./index.node')
|
|
|
|
|
|
|
|
const e = engine('model A {}')
|
|
|
|
|
|
|
|
export const benchQuery = () =>
|
|
|
|
b.suite(
|
|
|
|
'Query',
|
2021-06-22 00:09:13 +09:00
|
|
|
b.add('query * 100', async () => {
|
2021-06-03 00:03:47 +09:00
|
|
|
await Promise.all(Array.from({ length: 100 }).map(() => query(e)))
|
|
|
|
}),
|
2021-06-22 00:09:13 +09:00
|
|
|
b.add('query * 1', async () => {
|
2021-06-03 00:03:47 +09:00
|
|
|
await query(e)
|
|
|
|
}),
|
|
|
|
|
|
|
|
b.cycle(),
|
|
|
|
b.complete(),
|
|
|
|
)
|