BlogDocs

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

Merged
Merging
integration/fix-windows-notepad
(
2f6ee1b
) into
main
(
9bdd46e
)
-2%
IMPROVEMENTS
0
REGRESSIONS
0
UNTOUCHED
4
NEW
0
DROPPED
0
IGNORED
0

Benchmarks

client generation ~50 Models
packages/client/src/__tests__/benchmarks/huge-schema/huge-schema.bench.ts::typescript::client generation ~50 Models
0%
1.8 s
1.8 s
typescript compilation ~50 Models
packages/client/src/__tests__/benchmarks/huge-schema/huge-schema.bench.ts::typescript::typescript compilation ~50 Models
-8%
20.1 ms
21.7 ms
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
+1%
10.7 s
10.6 s
getPlatform
packages/get-platform/bench/get-platform.bench.ts::get-platform::getPlatform
-2%
13.9 ms
14.2 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
1 year ago
by aqrln
-1%
Always copy the engine files
2f6ee1b
1 year ago
by aqrln
ResourcesHomePricingDocsBlogGitHub
Copyright © 2024 CodSpeed Technology SAS. All rights reserved.