fix(client): Ensure `getDMMF` gets called only once
Problem: when we have a freshly instantiated client (haven't done
any queries yet) and we execute multiple queries at the same event loop
tick, each one of them will start getDMMF request, which could be
quite slow.
Fixed by caching the results promise first time getDMMF is called and
returning the same promise for subsequent calls.
Fix #14695
I read this comment https://github.com/prisma/prisma/issues/14695#issuecomment-1209226061
Runtime: 1.863s
Runtime: 1.756s
Runtime: 1.756s
However, I get
Runtime: 4.381s
Runtime: 320.656ms
Runtime: 261.909ms
(With the user repro and full schema)
It might be worth investigating passing a JS object from Rust instead of a json string. wdyt?
Sorry, forgot to push. Can you check now? The difference is that DMMFHelper creation is also moved into callOnce
Awesome, thanks for the quick fix!