aboutsummaryrefslogtreecommitdiffstats
path: root/packages/benchmarks/src/benchmarks.ts
diff options
context:
space:
mode:
authorMohamed Bassem <me@mbassem.com>2025-12-09 11:36:07 +0000
committerMohamed Bassem <me@mbassem.com>2025-12-09 20:17:10 +0000
commit265b677302fb1f63e6311adcd97685aeb1a99f82 (patch)
tree65dad55c133eea180de7fb0f6a8e57b9f53aadc5 /packages/benchmarks/src/benchmarks.ts
parent69a756aadd94c7a3f648373e1315edb8a245f20d (diff)
downloadkarakeep-265b677302fb1f63e6311adcd97685aeb1a99f82.tar.zst
chore: Allowing multi user benchmarks and adding more coverage
Diffstat (limited to 'packages/benchmarks/src/benchmarks.ts')
-rw-r--r--packages/benchmarks/src/benchmarks.ts70
1 files changed, 70 insertions, 0 deletions
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");