Commit 64462544 authored by rwbarton's avatar rwbarton Committed by Ben Gamari
Browse files

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
parent 10d28d0a
...@@ -1565,9 +1565,7 @@ instance Binary IfaceDecl where ...@@ -1565,9 +1565,7 @@ instance Binary IfaceDecl where
put_ bh (IfaceId name ty details idinfo) = do put_ bh (IfaceId name ty details idinfo) = do
putByte bh 0 putByte bh 0
putIfaceTopBndr bh name putIfaceTopBndr bh name
put_ bh ty lazyPut bh (ty, details, idinfo)
put_ bh details
put_ bh idinfo
put_ bh (IfaceData a1 a2 a3 a4 a5 a6 a7 a8 a9) = do put_ bh (IfaceData a1 a2 a3 a4 a5 a6 a7 a8 a9) = do
putByte bh 2 putByte bh 2
...@@ -1657,9 +1655,7 @@ instance Binary IfaceDecl where ...@@ -1657,9 +1655,7 @@ instance Binary IfaceDecl where
h <- getByte bh h <- getByte bh
case h of case h of
0 -> do name <- get bh 0 -> do name <- get bh
ty <- get bh ~(ty, details, idinfo) <- lazyGet bh
details <- get bh
idinfo <- get bh
return (IfaceId name ty details idinfo) return (IfaceId name ty details idinfo)
1 -> error "Binary.get(TyClDecl): ForeignType" 1 -> error "Binary.get(TyClDecl): ForeignType"
2 -> do a1 <- getIfaceTopBndr bh 2 -> do a1 <- getIfaceTopBndr bh
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment