Skip to content

Commit

Permalink
add knex (Kysely<any>) benches.
Browse files Browse the repository at this point in the history
  • Loading branch information
igalklebanov committed Jan 8, 2025
1 parent ba33afa commit 44390b8
Showing 1 changed file with 68 additions and 19 deletions.
87 changes: 68 additions & 19 deletions test/ts/selectFrom.bench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,45 +2,94 @@ import { bench } from '@ark/attest'
import type { DB } from '../typings/test-d/huge-db.test-d'
import type { Kysely } from '../../src/index.js'

declare const db: Kysely<DB>
declare const kysely: Kysely<DB>
declare const knex: Kysely<any>

bench.baseline(() => {})

bench('selectFrom(table)', () => {
return db.selectFrom('table_fff4c6195261874920bc7ce92d67d2c2')
bench('kysely.selectFrom(table)', () => {
return kysely.selectFrom('table_fff4c6195261874920bc7ce92d67d2c2')
}).types([388, 'instantiations'])

bench('selectFrom(~table)', () => {
return db.selectFrom('my_table2')
bench('kysely.selectFrom(~table)', () => {
return kysely.selectFrom('my_table2')
}).types([9314, 'instantiations'])

bench('selectFrom(table as alias)', () => {
return db.selectFrom('my_table as mt')
bench('kysely.selectFrom(table as alias)', () => {
return kysely.selectFrom('my_table as mt')
}).types([401, 'instantiations'])

bench('selectFrom([table])', () => {
return db.selectFrom(['my_table'])
bench('kysely.selectFrom([table])', () => {
return kysely.selectFrom(['my_table'])
}).types([413, 'instantiations'])

bench('selectFrom([~table])', () => {
return db.selectFrom(['my_table2'])
bench('kysely.selectFrom([~table])', () => {
return kysely.selectFrom(['my_table2'])
}).types([9364, 'instantiations'])

bench('selectFrom([table as alias])', () => {
return db.selectFrom(['my_table as mt'])
bench('kysely.selectFrom([table as alias])', () => {
return kysely.selectFrom(['my_table as mt'])
}).types([413, 'instantiations'])

bench('selectFrom([table, table])', () => {
return db.selectFrom(['my_table', 'table_000a8a0cb7f265a624c851d3e7f8b946'])
bench('kysely.selectFrom([table, table])', () => {
return kysely.selectFrom([
'my_table',
'table_000a8a0cb7f265a624c851d3e7f8b946',
])
}).types([413, 'instantiations'])

bench('selectFrom([table, ~table])', () => {
return db.selectFrom(['my_table', 'table_000a8a0cb7f265a624c851d3e7f8b9462'])
bench('kysely.selectFrom([table, ~table])', () => {
return kysely.selectFrom([
'my_table',
'table_000a8a0cb7f265a624c851d3e7f8b9462',
])
}).types([9367, 'instantiations'])

bench('selectFrom([table as alias, table as alias])', () => {
return db.selectFrom([
bench('kysely.selectFrom([table as alias, table as alias])', () => {
return kysely.selectFrom([
'my_table as mt',
'table_000a8a0cb7f265a624c851d3e7f8b946 as t',
])
}).types([413, 'instantiations'])

bench('knex.selectFrom(table)', () => {
return knex.selectFrom('table_fff4c6195261874920bc7ce92d67d2c2')
}).types([140, 'instantiations'])

bench('knex.selectFrom(~table)', () => {
return knex.selectFrom('my_table2')
}).types([140, 'instantiations'])

bench('knex.selectFrom(table as alias)', () => {
return knex.selectFrom('my_table as mt')
}).types([140, 'instantiations'])

bench('knex.selectFrom([table])', () => {
return knex.selectFrom(['my_table'])
}).types([165, 'instantiations'])

bench('knex.selectFrom([~table])', () => {
return knex.selectFrom(['my_table2'])
}).types([165, 'instantiations'])

bench('knex.selectFrom([table as alias])', () => {
return knex.selectFrom(['my_table as mt'])
}).types([165, 'instantiations'])

bench('knex.selectFrom([table, table])', () => {
return knex.selectFrom(['my_table', 'table_000a8a0cb7f265a624c851d3e7f8b946'])
}).types([165, 'instantiations'])

bench('knex.selectFrom([table, ~table])', () => {
return knex.selectFrom([
'my_table',
'table_000a8a0cb7f265a624c851d3e7f8b9462',
])
}).types([165, 'instantiations'])

bench('knex.selectFrom([table as alias, table as alias])', () => {
return knex.selectFrom([
'my_table as mt',
'table_000a8a0cb7f265a624c851d3e7f8b946 as t',
])
}).types([165, 'instantiations'])

0 comments on commit 44390b8

Please sign in to comment.