[commit: ghc] master: Deserialize IfaceId more lazily (6446254)

git at git.haskell.org git at git.haskell.org
Fri Mar 3 21:36:08 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/644625449a9b6fbeb9a81f1a7d0e7d18424fb707/ghc

>---------------------------------------------------------------

commit 644625449a9b6fbeb9a81f1a7d0e7d18424fb707
Author: Reid Barton <rwbarton at gmail.com>
Date:   Fri Mar 3 15:49:38 2017 -0500

    Deserialize IfaceId more lazily
    
    This change sped up the total validate --build-only time by 0.8%
    on my test system; hopefully a representative result.
    
    I didn't bother making the other constructors lazy because for
    IfaceData and IfaceClass we need to pull on some of the fields
    in loadDecl, and all the others seem much more rare than IfaceId.
    
    Test Plan: validate, perf
    
    Reviewers: austin, bgamari
    
    Reviewed By: bgamari
    
    Subscribers: thomie
    
    Differential Revision: https://phabricator.haskell.org/D3269


>---------------------------------------------------------------

644625449a9b6fbeb9a81f1a7d0e7d18424fb707
 compiler/iface/IfaceSyn.hs | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/compiler/iface/IfaceSyn.hs b/compiler/iface/IfaceSyn.hs
index d73a738..1c30476 100644
--- a/compiler/iface/IfaceSyn.hs
+++ b/compiler/iface/IfaceSyn.hs
@@ -1565,9 +1565,7 @@ instance Binary IfaceDecl where
     put_ bh (IfaceId name ty details idinfo) = do
         putByte bh 0
         putIfaceTopBndr bh name
-        put_ bh ty
-        put_ bh details
-        put_ bh idinfo
+        lazyPut bh (ty, details, idinfo)
 
     put_ bh (IfaceData a1 a2 a3 a4 a5 a6 a7 a8 a9) = do
         putByte bh 2
@@ -1657,9 +1655,7 @@ instance Binary IfaceDecl where
         h <- getByte bh
         case h of
             0 -> do name    <- get bh
-                    ty      <- get bh
-                    details <- get bh
-                    idinfo  <- get bh
+                    ~(ty, details, idinfo) <- lazyGet bh
                     return (IfaceId name ty details idinfo)
             1 -> error "Binary.get(TyClDecl): ForeignType"
             2 -> do a1  <- getIfaceTopBndr bh



More information about the ghc-commits mailing list