From fee42779f3ab78260af1a98ca16787364f81cf11 Mon Sep 17 00:00:00 2001 From: Chris Penner Date: Thu, 31 Aug 2023 15:11:18 -0700 Subject: [PATCH] Apply perf optimization: don't call callback unless there are changes --- parser-typechecker/src/U/Codebase/Branch/Diff.hs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/parser-typechecker/src/U/Codebase/Branch/Diff.hs b/parser-typechecker/src/U/Codebase/Branch/Diff.hs index 028c5ef515..e816daf034 100644 --- a/parser-typechecker/src/U/Codebase/Branch/Diff.hs +++ b/parser-typechecker/src/U/Codebase/Branch/Diff.hs @@ -222,11 +222,10 @@ streamNameChanges namePrefix (TreeDiff (DefinitionDiffs {termDiffs, typeDiffs} : let name = appendName ns in (listifyNames name $ adds diff, listifyNames name $ removals diff) let nameChanges = NameChanges {termNameAdds, termNameRemovals, typeNameAdds, typeNameRemovals} - acc <- f namePrefix nameChanges - -- acc <- - -- if nameChanges == mempty - -- then pure mempty - -- else f namePrefix nameChanges + acc <- + if nameChanges == mempty + then pure mempty + else f namePrefix nameChanges childAcc <- children & ifoldMapM