mirror of
https://github.com/jfmengels/elm-review.git
synced 2024-11-23 23:05:35 +03:00
Make graph creation a bit more performant
This commit is contained in:
parent
d7d49501e1
commit
c4fbda59c4
@ -299,8 +299,8 @@ nodesAndEdges getFileId module_ fileId =
|
||||
, importedModules module_
|
||||
|> List.filterMap getFileId
|
||||
|> List.map
|
||||
(\importFileId ->
|
||||
Graph.Edge fileId importFileId ()
|
||||
(\importedFileId ->
|
||||
Graph.Edge importedFileId fileId ()
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -809,8 +809,8 @@ importedModulesFirst (MultiSchema schema) startCache project =
|
||||
newCache : MultiRuleCache globalContext
|
||||
newCache =
|
||||
-- TODO Need to invalidate the cache if an imported module changes
|
||||
List.foldr
|
||||
(\{ node, outgoing } cache ->
|
||||
List.foldl
|
||||
(\{ node, incoming } cache ->
|
||||
let
|
||||
maybeModule : Maybe ParsedFile
|
||||
maybeModule =
|
||||
@ -823,7 +823,7 @@ importedModulesFirst (MultiSchema schema) startCache project =
|
||||
Just module_ ->
|
||||
case Dict.get module_.path cache of
|
||||
Nothing ->
|
||||
Dict.insert module_.path (computeModule cache outgoing module_) cache
|
||||
Dict.insert module_.path (computeModule cache incoming module_) cache
|
||||
|
||||
Just cacheEntry ->
|
||||
if cacheEntry.source == module_.source then
|
||||
@ -831,7 +831,7 @@ importedModulesFirst (MultiSchema schema) startCache project =
|
||||
cache
|
||||
|
||||
else
|
||||
Dict.insert module_.path (computeModule cache outgoing module_) cache
|
||||
Dict.insert module_.path (computeModule cache incoming module_) cache
|
||||
)
|
||||
startCache
|
||||
nodeContexts
|
||||
|
Loading…
Reference in New Issue
Block a user