Disable scenario service during packaging (#6543)

For `damlc test` and `damlc ide`, `optScenarioService` is (correctly)
enabled. However, every call to `withDamlIdeState` will spawn a
scenario service. This means that during package initialization we
will spawn at least one extra scenario service (potentially) more. On
a simple project this gets `damlc test` from 10s down to 7s and I see
a noticeable (although hard to measure) speedup in IDE startup time.

changelog_begin
changelog_end
This commit is contained in:
Moritz Kiefer 2020-06-30 16:45:52 +02:00 committed by GitHub
parent 470d4f28a5
commit 6213f560ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -70,7 +70,7 @@ import SdkVersion
-- and then remap references to those dummy packages to the original DAML-LF
-- package id.
createProjectPackageDb :: NormalizedFilePath -> Options -> PackageSdkVersion -> MS.Map UnitId GHC.ModuleName -> [FilePath] -> [FilePath] -> IO ()
createProjectPackageDb projectRoot opts thisSdkVer modulePrefixes deps dataDeps
createProjectPackageDb projectRoot (disableScenarioService -> opts) thisSdkVer modulePrefixes deps dataDeps
| null dataDeps && all (`elem` basePackages) deps =
-- Initializing the package db is expensive since it requires calling GenerateStablePackages and GeneratePackageMap.
--Therefore we only do it if we actually have a dependency.
@ -194,6 +194,11 @@ createProjectPackageDb projectRoot opts thisSdkVer modulePrefixes deps dataDeps
removePathForcibly dbPath
createDirectoryIfMissing True $ dbPath </> "package.conf.d"
disableScenarioService :: Options -> Options
disableScenarioService opts = opts
{ optScenarioService = EnableScenarioService False
}
toGhcModuleName :: LF.ModuleName -> GHC.ModuleName
toGhcModuleName = GHC.mkModuleName . T.unpack . LF.moduleNameString