From 265b677302fb1f63e6311adcd97685aeb1a99f82 Mon Sep 17 00:00:00 2001 From: Mohamed Bassem Date: Tue, 9 Dec 2025 11:36:07 +0000 Subject: chore: Allowing multi user benchmarks and adding more coverage --- packages/benchmarks/src/benchmarks.ts | 70 +++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) (limited to 'packages/benchmarks/src/benchmarks.ts') diff --git a/packages/benchmarks/src/benchmarks.ts b/packages/benchmarks/src/benchmarks.ts index f2883246..5f3601e4 100644 --- a/packages/benchmarks/src/benchmarks.ts +++ b/packages/benchmarks/src/benchmarks.ts @@ -81,6 +81,76 @@ export async function runBenchmarks( }); }); + // Benchmark with cursor (without listId) + { + const firstPage = await seed.trpc.bookmarks.getBookmarks.query({ + limit: 50, + }); + bench.add("bookmarks.getBookmarks (with cursor)", async () => { + if (firstPage.nextCursor) { + await seed.trpc.bookmarks.getBookmarks.query({ + limit: 50, + cursor: firstPage.nextCursor, + }); + } + }); + } + + // Benchmark with cursor and listId + if (sampleList) { + const firstPage = await seed.trpc.bookmarks.getBookmarks.query({ + limit: 50, + listId: sampleList.id, + }); + bench.add("bookmarks.getBookmarks (cursor + list filter)", async () => { + if (firstPage.nextCursor) { + await seed.trpc.bookmarks.getBookmarks.query({ + limit: 50, + listId: sampleList.id, + cursor: firstPage.nextCursor, + }); + } + }); + } + + // Benchmark with archived filter + bench.add("bookmarks.getBookmarks (archived filter)", async () => { + await seed.trpc.bookmarks.getBookmarks.query({ + limit: 50, + archived: true, + }); + }); + + // Benchmark with favourited filter + bench.add("bookmarks.getBookmarks (favourited filter)", async () => { + await seed.trpc.bookmarks.getBookmarks.query({ + limit: 50, + favourited: true, + }); + }); + + // Benchmark with archived and list filter combined + if (sampleList) { + bench.add("bookmarks.getBookmarks (archived + list filter)", async () => { + await seed.trpc.bookmarks.getBookmarks.query({ + limit: 50, + archived: true, + listId: sampleList.id, + }); + }); + } + + // Benchmark with favourited and list filter combined + if (sampleList) { + bench.add("bookmarks.getBookmarks (favourited + list filter)", async () => { + await seed.trpc.bookmarks.getBookmarks.query({ + limit: 50, + favourited: true, + listId: sampleList.id, + }); + }); + } + logStep("Running benchmarks"); await bench.run(); logSuccess("Benchmarks complete"); -- cgit v1.2.3-70-g09d2