Avatar for the prisma user
prisma
prisma
BlogDocsChangelog

fix(client): don't run engines before copying

#19225Merged
Comparing
integration/fix-windows-notepad
(
2f6ee1b
) with
main
(
9bdd46e
)
CodSpeed Performance Gauge
-2%
Improvements
0
Regressions
0
Untouched
4
New
0
Dropped
0
Ignored
0

Benchmarks

Passed

client generation 100 models with relations
packages/client/src/__tests__/benchmarks/lots-of-relations/lots-of-relations.bench.ts::typescript::client generation 100 models with relations
CodSpeed Performance Gauge
+1%
10.7 s
10.6 s
client generation ~50 Models
packages/client/src/__tests__/benchmarks/huge-schema/huge-schema.bench.ts::typescript::client generation ~50 Models
CodSpeed Performance Gauge
0%
1.8 s
1.8 s
getPlatform
packages/get-platform/bench/get-platform.bench.ts::get-platform::getPlatform
CodSpeed Performance Gauge
-2%
13.9 ms
14.2 ms
typescript compilation ~50 Models
packages/client/src/__tests__/benchmarks/huge-schema/huge-schema.bench.ts::typescript::typescript compilation ~50 Models
CodSpeed Performance Gauge
-8%
20.1 ms
21.7 ms

Commits

Click on a commit to change the comparison range
Base
main
9bdd46e
-1%
fix(client): don't try to run non-native engines before copying Don't try to run non-native engines querying them for version when determining whether they should be overwritten during generation. This PR takes a rather conservative approach to fix the issue by adding a check to compare the binary target of each engine with the current platform. This only fixes the bug without changing the performance characteristics of the code in any way (`getPlatform` is memoized so calling it is essentially free at this point). However, we should benchmark and re-evaluate if these checks provide any benefit compared to just always copying and overwriting the engines upon generation. When using the library engine, the version check also leads to increased memory usage, as unlike with the binary engine, all of the successfully loaded libraries (usually two when regenerating existing client, but potentially even more on Linux since there may be multiple binary targets compatible with the current system) will stay loaded in memory until the generator process exits. This also runs the napi-rs initialization code for each of them, and we don't use Query Engine for anything else anymore in the generator, so this is the only time QE is currently loaded during generation. Fixes: https://github.com/prisma/prisma/issues/4308
e3b586f
2 years ago
by aqrln
-1%
Always copy the engine files
2f6ee1b
2 years ago
by aqrln
© 2025 CodSpeed Technology
Home Terms Privacy Docs