MCPcopy
hub / github.com/kysely-org/kysely / test

Function test

test/node/src/performance.test.ts:35–58  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

33
34 it('simple query builder performance test', async () => {
35 function test() {
36 ctx.db
37 .selectFrom(['person as p', 'pet'])
38 .innerJoin('toy', 'toy.pet_id', 'pet.id')
39 .whereRef('p.id', '=', 'pet.owner_id')
40 .where('toy.id', '=', 1)
41 .where('p.id', 'in', [1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
42 .where(({ exists, selectFrom }) =>
43 exists(
44 selectFrom('toy_schema.toy').whereRef(
45 'toy_schema.toy.id',
46 '=',
47 'toy.id',
48 ),
49 ),
50 )
51 .select([
52 'toy.price as price',
53 sql`concat(${sql.ref('first_name')}, ' ', ${sql.ref(
54 'last_name',
55 )})`.as('full_name'),
56 ])
57 .compile()
58 }
59
60 const WARMUP_ROUNDS = 1000
61 const TEST_ROUNDS = 100000

Callers 1

Calls 10

existsFunction · 0.85
selectFromFunction · 0.85
compileMethod · 0.65
selectMethod · 0.65
whereMethod · 0.65
whereRefMethod · 0.65
innerJoinMethod · 0.65
selectFromMethod · 0.65
asMethod · 0.65
refMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…