Merge pull request #2117 from unisonweb/fix/server-performance-bug

Fix possible quadratic performance bug in Backend.hs
This commit is contained in:
Rúnar 2021-06-16 11:03:24 -04:00 committed by GitHub
commit becea9aef4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -557,21 +557,19 @@ prettyDefinitionsBySuffixes relativeTo root renderWidth suffixifyBindings codeba
termFqns :: Map Reference (Set Text)
termFqns = Map.mapWithKey f terms
where
f k _ =
R.lookupRan (Referent.Ref' k)
. R.filterDom (\n -> "." `Text.isPrefixOf` n && n /= ".")
rel = R.filterDom (\n -> "." `Text.isPrefixOf` n && n /= ".")
. R.mapDom Name.toText
. Names.terms
$ currentNames parseNames
f k _ = R.lookupRan (Referent.Ref' k) rel
typeFqns :: Map Reference (Set Text)
typeFqns = Map.mapWithKey f types
where
f k _ =
R.lookupRan k
. R.filterDom (\n -> "." `Text.isPrefixOf` n && n /= ".")
rel = R.filterDom (\n -> "." `Text.isPrefixOf` n && n /= ".")
. R.mapDom Name.toText
. Names.types
$ currentNames parseNames
f k _ = R.lookupRan k rel
flatten = Set.toList . fromMaybe Set.empty
mkTermDefinition r tm = do
ts <- lift (Codebase.getTypeOfTerm codebase r)