omgwotO
tRPC2y ago
4 replies
omgwot

Need help with performance

Hello, tRPC is still dreadfully slow for us. It's borderline unusable without disableSourceOfProjectReferenceRedirect": true in tsconfig.json.

I've realized that it's partly because we load all procedures from all routers into memory on every autocomplete access in the TypeScript language server.

How can we split up the routers? I read on GitHub that maybe they should be separate packages, but how would that even work? We specifically need to be able to infer the types of specific routers so that our TypeScript language server doesn't slow to a halt.

This seems basically impossible with this current tRPC API where everything must be bundled into a single MergeRouter type. We've tried splitting things up (like for instance, a v1Router and a v2Router) so that the entire router is not enumerated but then the issue becomes namespacing, because we want v1 and v2 to be under their own routers:

router({
  v1: v1Router
  v2: v2Router
})


or

mergeRouters([v1Router, v2Router])


We really need a way to do this. tRPC is borderline unusable for us when everything is in one router. Can anyone help here?
Was this page helpful?