Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add TypeScript benchmarks. #1314

Open
wants to merge 20 commits into
base: v0.28
Choose a base branch
from

Conversation

igalklebanov
Copy link
Member

Hey 👋

Taking the TypeScript performance investigation and regression protection a step further and adding @ark/attest benches.

To demo it, I'm experimenting with QueryCreator.selectFrom improvements.

How to use it:
https://www.edgedb.com/blog/an-approach-to-optimizing-typescript-type-checking-performance#marking-the-workbench

igalklebanov and others added 17 commits January 5, 2025 13:58
…kysely-org#1085)

* add reusable helpers recipe and implement missing expression features

* force node 22.4.1 in CI because of an npm bug
* feat: add postgres range types (kysely-org#1086)

* feat: support refresh naterialized view

* fix tests by adding .materialized() to remove the matview

* fix failing test

* fix: References typo (kysely-org#1092)

* chore: refresh-view-node.ts => refresh-materialized-view-node.ts

* chore: export node in index.ts

---------

Co-authored-by: Isak <16906089+kansson@users.noreply.github.com>
Co-authored-by: Jonathan Wu <jonathanwu70@gmail.com>
Co-authored-by: Igal Klebanov <igal@grainfinance.co>
* feat: empty where in plugin

* test: add new tests

* chore: remove unneccesary typeguards

* fix: change to binary operator node

* test: update tests to do both in and not in

* test: for having

* chore: rm test

* test: nullable tests

* chore: nit

* chore: condense suite

* chore: db config override

* chore: extra console log

* chore: empty arr plugin docs

* HandleEmptyInListsPlugin initial commit.

Co-authored-by: Austin Woon Quan <43132101+austinwoon@users.noreply.github.com>

---------

Co-authored-by: Austin Woon <austin@open.gov.sg>
Co-authored-by: igalklebanov <igalklebanov@gmail.com>
remove only.
Co-authored-by: vincentiusvin <54709710+vincentiusvin@users.noreply.github.com>
Co-authored-by: Igal Klebanov <igalklebanov@gmail.com>
Copy link

vercel bot commented Jan 8, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
kysely ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 9, 2025 10:39am

mistake benches.

add knex (Kysely<any>) benches.

..

remove corepack.

..
@igalklebanov
Copy link
Member Author

igalklebanov commented Jan 8, 2025

Results after re-ordering SelectFrom type's branching by commonality. single table > multi-table > expression/s.
Less instantiations better.
knex.* is Kysely<any>

Mistakes (~) are now significantly cheaper.
Single table is now cheaper.
Multi-table a bit more expensive now - less common so no biggy.

🏌️  kysely.selectFrom(table)
⛳ Result: 372 instantiations
🎯 Baseline: 388 instantiations
📊 Delta: -4.12%

🏌️  kysely.selectFrom(~table)
⛳ Result: 6864 instantiations
🎯 Baseline: 9314 instantiations
📉 kysely.selectFrom(~table) was under baseline by 26.30%! Consider setting a new baseline.

🏌️  kysely.selectFrom(table as alias)
⛳ Result: 385 instantiations
🎯 Baseline: 401 instantiations
📊 Delta: -3.99%

🏌️  kysely.selectFrom([table])
⛳ Result: 427 instantiations
🎯 Baseline: 413 instantiations
📊 Delta: +3.39%

🏌️  kysely.selectFrom([~table])
⛳ Result: 6914 instantiations
🎯 Baseline: 9364 instantiations
📉 kysely.selectFrom([~table]) was under baseline by 26.16%! Consider setting a new baseline.

🏌️  kysely.selectFrom([table as alias])
⛳ Result: 427 instantiations
🎯 Baseline: 413 instantiations
📊 Delta: +3.39%

🏌️  kysely.selectFrom([table, table])
⛳ Result: 427 instantiations
🎯 Baseline: 413 instantiations
📊 Delta: +3.39%

🏌️  kysely.selectFrom([table, ~table])
⛳ Result: 6917 instantiations
🎯 Baseline: 9367 instantiations
📉 kysely.selectFrom([table, ~table]) was under baseline by 26.16%! Consider setting a new baseline.

🏌️  kysely.selectFrom([table as alias, table as alias])
⛳ Result: 427 instantiations
🎯 Baseline: 413 instantiations
📊 Delta: +3.39%

🏌️  knex.selectFrom(table)
⛳ Result: 124 instantiations
🎯 Baseline: 140 instantiations
📊 Delta: -11.43%

🏌️  knex.selectFrom(~table)
⛳ Result: 124 instantiations
🎯 Baseline: 140 instantiations
📊 Delta: -11.43 %

🏌️  knex.selectFrom(table as alias)
⛳ Result: 124 instantiations
🎯 Baseline: 140 instantiations
📊 Delta: -11.43%

🏌️  knex.selectFrom([table])
⛳ Result: 179 instantiations
🎯 Baseline: 165 instantiations
📊 Delta: +8.48%

🏌️  knex.selectFrom([~table])
⛳ Result: 179 instantiations
🎯 Baseline: 165 instantiations
📊 Delta: +8.48%

🏌️  knex.selectFrom([table as alias])
⛳ Result: 179 instantiations
🎯 Baseline: 165 instantiations
📊 Delta: +8.48%

🏌️  knex.selectFrom([table, table])
⛳ Result: 179 instantiations
🎯 Baseline: 165 instantiations
📊 Delta: +8.48%

🏌️  knex.selectFrom([table, ~table])
⛳ Result: 179 instantiations
🎯 Baseline: 165 instantiations
📊 Delta: +8.48%

🏌️  knex.selectFrom([table as alias, table as alias])
⛳ Result: 179 instantiations
🎯 Baseline: 165 instantiations
📊 Delta: +8.48%

Copy link

pkg-pr-new bot commented Jan 8, 2025

Open in Stackblitzkysely_koa_example

npm i https://pkg.pr.new/kysely-org/kysely@1314

commit: 3ae8c16

@igalklebanov igalklebanov marked this pull request as ready for review January 8, 2025 08:30
@igalklebanov igalklebanov added typescript Related to Typescript CI Related to CICD labels Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI Related to CICD typescript Related to Typescript
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants