on master help sign in
Fully evaluate Text from Binary

Decreases the initial load time from 1.5 to 1.05 s Decreases the allocation from 1.35 GB to 1.07.

commit518055f9b52fba9c5701b1b40ad48837b54ec8fc authorNiklas Larsson <niklas@mm.st> dateSun 17 May 2015, 00:45 (11 years ago) parent1d8723b
1 file changed+3−1
src/Idris/Core/Binary.hs+3−1
src/Idris/Core/Binary.hs+3−1
@@ -5,6 +5,7 @@ module Idris.Core.Binary where
55
66import Control.Applicative ((<*>), (<$>))
77import Control.Monad (liftM2)
8+import Control.DeepSeq (($!!))
89
910import Data.Binary
1011import Data.Vector.Binary
@@ -308,7 +309,8 @@ instance Binary Name where
308309instance Binary T.Text where
309310 put x = put (E.encodeUtf8 x)
310311 get = do x <- get
311− return (E.decodeUtf8 x)
312+ return $!! (E.decodeUtf8 x)
313+
312314
313315instance Binary SpecialName where
314316 put x