[Git][ghc/ghc][wip/T23923-mikolaj-take-2] Touch up the new Note
Mikolaj Konarski (@Mikolaj)
gitlab at gitlab.haskell.org
Fri Apr 5 14:42:28 UTC 2024
Mikolaj Konarski pushed to branch wip/T23923-mikolaj-take-2 at Glasgow Haskell Compiler / GHC
Commits:
6eedc476 by Mikolaj Konarski at 2024-04-05T16:01:14+02:00
Touch up the new Note
- - - - -
1 changed file:
- compiler/GHC/Core/TyCo/Rep.hs
Changes:
=====================================
compiler/GHC/Core/TyCo/Rep.hs
=====================================
@@ -1796,7 +1796,6 @@ In particular, given
| tv `elemVarSet` acc = acc
| otherwise = acc `extendVarSet` tv
-
we want to end up with
fvs ty = go emptyVarSet ty emptyVarSet
where
@@ -1832,9 +1831,9 @@ Note [Use explicit recursion in foldTyCo]
In foldTyCo you'll see things like:
go_tys _ [] = mempty
go_tys env (t:ts) = go_ty env t `mappend` go_tys env ts
-where we use /explicit recursion/. You might wonder about using foldr instead:
+where we use /explicit recursion/. You might wonder about using foldl instead:
go_tys env = foldl (\t acc -> go_ty env t `mappend` acc) mempty
-Or maybe or foldl', or foldr.
+Or maybe foldl', or foldr.
But don't do that for two reasons (see #24591)
@@ -1848,7 +1847,7 @@ But don't do that for two reasons (see #24591)
But in the foldl form that is /much/ less obvious, and the strictness
analyser fails utterly. Result: lots and lots of thunks get built. In
- !12037, Mikolaj found that GHC allocated allocated /six times/ as much heap
+ !12037, Mikolaj found that GHC allocated /six times/ as much heap
on test perf/compiler/T9198 as a result of this single problem!
* Second, while I think that using `foldr` would be fine (simple experiments in
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/6eedc47691c7078c731a3e51db92b9c68bf35b3a
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/6eedc47691c7078c731a3e51db92b9c68bf35b3a
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20240405/ec4affa4/attachment-0001.html>
More information about the ghc-commits
mailing list