-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Establish baseline for select type instantiations (#829)
- Loading branch information
1 parent
a19f1a7
commit bdedea5
Showing
4 changed files
with
138 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
import { bench } from "@arktype/attest"; | ||
|
||
import e from "./dbschema/edgeql-js"; | ||
|
||
bench("select: scalar", () => { | ||
const query = e.select(e.int32(42)); | ||
return {} as typeof query; | ||
}).types([1263, "instantiations"]); | ||
|
||
bench("select: free object", () => { | ||
const query = e.select({ meaning: e.int32(42) }); | ||
return {} as typeof query; | ||
}).types([2120, "instantiations"]); | ||
|
||
bench("select: id only", () => { | ||
const query = e.select(e.User, () => ({ id: true })); | ||
return {} as typeof query; | ||
}).types([3642, "instantiations"]); | ||
|
||
bench("select: filtered", () => { | ||
const query = e.select(e.User, () => ({ | ||
filter_single: { id: e.uuid("123") }, | ||
})); | ||
return {} as typeof query; | ||
}).types([5384, "instantiations"]); | ||
|
||
bench("select: nested", () => { | ||
const user = e.select(e.User, () => ({ | ||
filter_single: { id: e.uuid("123") }, | ||
})); | ||
const query = e.select(user, () => ({ id: true })); | ||
|
||
return {} as typeof query; | ||
}).types([7412, "instantiations"]); | ||
|
||
bench("select: complex", () => { | ||
const query = e.select(e.Movie, () => ({ | ||
id: true, | ||
characters: (char) => ({ | ||
name: true, | ||
"@character_name": true, | ||
filter: e.op(char["@character_name"], "=", "Tony Stark"), | ||
}), | ||
})); | ||
return {} as typeof query; | ||
}).types([6339, "instantiations"]); | ||
|
||
bench("select: with filter", () => { | ||
const query = e.select(e.Hero, (hero) => ({ | ||
name: true, | ||
villains: { | ||
id: true, | ||
name: true, | ||
}, | ||
filter_single: e.op(hero.name, "=", "Peter Parker"), | ||
})); | ||
return {} as typeof query; | ||
}).types([98669, "instantiations"]); | ||
|
||
bench("select: with order", () => { | ||
const query = e.select(e.Hero, (hero) => ({ | ||
name: true, | ||
villains: (v) => ({ | ||
id: true, | ||
name: true, | ||
order_by: v.name, | ||
}), | ||
filter_single: e.op(hero.name, "=", "Peter Parker"), | ||
})); | ||
return {} as typeof query; | ||
}).types([98963, "instantiations"]); | ||
|
||
bench("select: with limit", () => { | ||
const query = e.select(e.Hero, (hero) => ({ | ||
name: true, | ||
villains: () => ({ | ||
id: true, | ||
name: true, | ||
limit: 1, | ||
}), | ||
filter_single: e.op(hero.name, "=", "Peter Parker"), | ||
})); | ||
return {} as typeof query; | ||
}).types([98694, "instantiations"]); | ||
|
||
bench("select: with offset", () => { | ||
const query = e.select(e.Hero, (hero) => ({ | ||
name: true, | ||
villains: (v) => ({ | ||
id: true, | ||
name: true, | ||
offset: 1, | ||
}), | ||
filter_single: e.op(hero.name, "=", "Peter Parker"), | ||
})); | ||
return {} as typeof query; | ||
}).types([98730, "instantiations"]); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,26 @@ | |
"@jridgewell/gen-mapping" "^0.3.0" | ||
"@jridgewell/trace-mapping" "^0.3.9" | ||
|
||
"@arktype/attest@^0.5.0": | ||
version "0.5.0" | ||
resolved "https://registry.yarnpkg.com/@arktype/attest/-/attest-0.5.0.tgz#bee97b89603af05ca77a5aed07cef77f746d386b" | ||
integrity sha512-MRWnjq2rAJLhPZP9GqWHLyIOBomzxcJxHdzANNcEZV/EXdutS4YumdoHi3NEsk6zt0kscqk4reRRPnUa2zwhrQ== | ||
dependencies: | ||
"@arktype/fs" "0.0.10" | ||
"@arktype/util" "0.0.16" | ||
"@typescript/vfs" "1.5.0" | ||
arktype latest | ||
|
||
"@arktype/[email protected]": | ||
version "0.0.10" | ||
resolved "https://registry.yarnpkg.com/@arktype/fs/-/fs-0.0.10.tgz#2d728c99856554a08725b81d970bd1dc1a4e0d91" | ||
integrity sha512-aPYLmcdS7eHUftTQOyPZRdoMWrvuk4m0LwO6dB9fwKqJTngnizWAeP0AS+tMincPhdZEahRyX0ju9Czvdm/zkQ== | ||
|
||
"@arktype/[email protected]": | ||
version "0.0.16" | ||
resolved "https://registry.yarnpkg.com/@arktype/util/-/util-0.0.16.tgz#2401e3ac238f135ab1fa81ad4f849d0783318534" | ||
integrity sha512-a10hhQ5E95tV0wfi8N9/74Uo6mRDHjeGWaHsyZriq4a9srZ9AbJ3UlYUQfIaQgsxLIuMw3kdClsE/H3tMdZKvw== | ||
|
||
"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.12.13", "@babel/code-frame@^7.18.6", "@babel/code-frame@^7.21.4": | ||
version "7.21.4" | ||
resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.21.4.tgz#d0fa9e4413aca81f2b23b9442797bda1826edb39" | ||
|
@@ -1459,6 +1479,13 @@ | |
"@typescript-eslint/types" "5.60.1" | ||
eslint-visitor-keys "^3.3.0" | ||
|
||
"@typescript/[email protected]": | ||
version "1.5.0" | ||
resolved "https://registry.yarnpkg.com/@typescript/vfs/-/vfs-1.5.0.tgz#ed942922724f9ace8c07c80b006c47e5e3833218" | ||
integrity sha512-AJS307bPgbsZZ9ggCT3wwpg3VbTKMFNHfaY/uF0ahSkYYrPF2dSSKDNIDIQAHm9qJqbLvCsSJH7yN4Vs/CsMMg== | ||
dependencies: | ||
debug "^4.1.1" | ||
|
||
"@web3-storage/multipart-parser@^1.0.0": | ||
version "1.0.0" | ||
resolved "https://registry.yarnpkg.com/@web3-storage/multipart-parser/-/multipart-parser-1.0.0.tgz#6b69dc2a32a5b207ba43e556c25cc136a56659c4" | ||
|
@@ -1568,6 +1595,11 @@ argparse@^2.0.1: | |
resolved "https://registry.yarnpkg.com/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38" | ||
integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q== | ||
|
||
arktype@latest: | ||
version "1.0.28-alpha" | ||
resolved "https://registry.yarnpkg.com/arktype/-/arktype-1.0.28-alpha.tgz#26cb8ea9fef86a4dbae4868d6e5ba98b5f34f5b7" | ||
integrity sha512-cjakiZXXa4+y1OL0oFk0HRjIrEwJhNNvkqXkiR53SOpyKHwSqFrjrQkY4K8MlnQybRhd/y4OG4NVDR1Ea4WDkQ== | ||
|
||
[email protected]: | ||
version "1.1.1" | ||
resolved "https://registry.yarnpkg.com/array-flatten/-/array-flatten-1.1.1.tgz#9a5f699051b1e7073328f2a008968b64ea2955d2" | ||
|