summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReid Barton <rwbarton@gmail.com>2017-03-03 15:49:38 -0500
committerBen Gamari <ben@smart-cactus.org>2017-03-03 15:49:39 -0500
commit644625449a9b6fbeb9a81f1a7d0e7d18424fb707 (patch)
treeaa0aac1e32014292d624c9592d871e63b94593a9
parent10d28d0ababe52a705c10d450869d7a61063c4ae (diff)
downloadhaskell-644625449a9b6fbeb9a81f1a7d0e7d18424fb707.tar.gz
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
-rw-r--r--compiler/iface/IfaceSyn.hs8
1 files changed, 2 insertions, 6 deletions
diff --git a/compiler/iface/IfaceSyn.hs b/compiler/iface/IfaceSyn.hs
index d73a738786..1c30476960 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