Skip to content

Commit

Permalink
enum perf tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jraymakers committed Mar 24, 2024
1 parent b1e03ab commit 137583f
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions api/test/perf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,43 @@ describe('perf', () => {
connection.dispose();
instance.dispose();
});
it('of enum (small)', async () => {
const instance = await DuckDBInstance.create();
const connection = await instance.connect();
await connection.run(`create type small_enum as enum ('a', 'b')`);
console.log(await measureQueryMultiple(
connection,
`select 'a'::small_enum from range(1000000)`,
5,
));
connection.dispose();
instance.dispose();
});
it('of enum (medium)', async () => {
const instance = await DuckDBInstance.create();
const connection = await instance.connect();
await connection.run(`create type medium_enum as enum (select 'enum_' || i from range(300) t(i))`);
console.log(await measureQueryMultiple(
connection,
`select 'enum_0'::medium_enum from range(1000000)`,
5,
));
connection.dispose();
instance.dispose();
});
// This runs out of memory!
xit('of enum (large)', async () => {
const instance = await DuckDBInstance.create();
const connection = await instance.connect();
await connection.run(`create type large_enum as enum (select 'enum_' || i from range(70000) t(i))`);
console.log(await measureQueryMultiple(
connection,
`select 'enum_0'::large_enum from range(1000000)`,
5,
));
connection.dispose();
instance.dispose();
});
it('of list[int]', async () => {
const instance = await DuckDBInstance.create();
const connection = await instance.connect();
Expand Down

0 comments on commit 137583f

Please sign in to comment.