Speed up computeModules

This commit is contained in:
Jeroen Engels 2022-09-17 21:40:23 +02:00
parent bba7e19bbd
commit e726935135
2 changed files with 15 additions and 13 deletions

View File

@ -4393,9 +4393,7 @@ computeModules projectVisitor ( moduleVisitor, moduleContextCreator ) project ex
projectModulePaths : Set String
projectModulePaths =
modulesToAnalyze
|> List.map .path
|> Set.fromList
List.foldl (\{ path } acc -> Set.insert path acc) Set.empty modulesToAnalyze
modules : Dict ModuleName ProjectModule
modules =
@ -4447,13 +4445,17 @@ computeModules projectVisitor ( moduleVisitor, moduleContextCreator ) project ex
let
projectContext : projectContext
projectContext =
importedModules
|> List.filterMap
(\importedModule ->
Dict.get importedModule.path cache
|> Maybe.map .context
)
|> List.foldl foldProjectContexts initialProjectContext
List.foldl
(\importedModule accContext ->
case Dict.get importedModule.path cache of
Just importedModuleCache ->
foldProjectContexts importedModuleCache.context accContext
Nothing ->
accContext
)
initialProjectContext
importedModules
in
-- It is never used anywhere else
applyContextCreator availableData moduleContextCreator projectContext
@ -4465,7 +4467,7 @@ computeModules projectVisitor ( moduleVisitor, moduleContextCreator ) project ex
module_
in
{ source = module_.source
, errors = List.map (setFilePathIfUnset module_) moduleErrors
, errors = ListExtra.orderIndependentMap (setFilePathIfUnset module_) moduleErrors
, context =
case getFolderFromTraversal projectVisitor.traversalAndFolder of
Just { fromModuleToProject } ->

View File

@ -3779,7 +3779,7 @@ a =
a =
if a || b then
1
else if a then
else if b then
2
else
3
@ -3793,7 +3793,7 @@ a =
a =
if a || b then
1
else if b then
else if a then
2
else
3