[Git][ghc/ghc][wip/andreask/opt-getlevity] Optimize getLevity.

Andreas Klebinger (@AndreasK) gitlab at gitlab.haskell.org
Wed Oct 5 15:45:57 UTC 2022



Andreas Klebinger pushed to branch wip/andreask/opt-getlevity at Glasgow Haskell Compiler / GHC


Commits:
16aba966 by Andreas Klebinger at 2022-10-05T17:42:15+02:00
Optimize getLevity.

Avoid the intermediate data structures allocated by splitTyConApp.
This avoids ~0.5% of allocations for a build using -O2.

Fixes #22254

- - - - -


1 changed file:

- compiler/GHC/Core/Type.hs


Changes:

=====================================
compiler/GHC/Core/Type.hs
=====================================
@@ -2541,8 +2541,8 @@ getRuntimeRep ty
 getLevity_maybe :: HasDebugCallStack => Type -> Maybe Type
 getLevity_maybe ty
   | Just rep <- getRuntimeRep_maybe ty
-  , Just (tc, [lev]) <- splitTyConApp_maybe rep
-  , tc == boxedRepDataConTyCon
+  , TyConApp tc [lev] <- coreFullView rep
+  , boxedRepDataConTyCon == tc
   = Just lev
   | otherwise
   = Nothing



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/16aba9660c2e3a00ae912d7d54b86f741bdcb8f6

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/16aba9660c2e3a00ae912d7d54b86f741bdcb8f6
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/20221005/4d2dd902/attachment.html>


More information about the ghc-commits mailing list