From 07a6123d56df03e5d7c40384c87f6c40ae2b5131 Mon Sep 17 00:00:00 2001 From: Sam T Date: Wed, 3 Jul 2013 00:17:16 +0400 Subject: ~ Use lazy bytestring This lead to the following consequences: * we could efficiently read from storage - if block intersects files boundaries then we will "view" the block in the two different bytestrings. To avoid concat we now return lazy bytestring; * we could read block from socket without "concat" - again, for the same reason. The pitfail is that now we have a bit more heap object, but blocks lifetime is very short and this shouldnt play the big difference. The lifetime is either (socket -> storage -> unreachable) or (storage -> socket -> unreachable) unless a lib user keep block for their own purposes. --- tests/Main.hs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'tests') diff --git a/tests/Main.hs b/tests/Main.hs index b99f2469..45f92813 100644 --- a/tests/Main.hs +++ b/tests/Main.hs @@ -161,6 +161,9 @@ positive = fromIntegral <$> (arbitrary :: Gen Word32) instance Arbitrary ByteString where arbitrary = B.pack <$> arbitrary +instance Arbitrary Lazy.ByteString where + arbitrary = Lazy.pack <$> arbitrary + instance Arbitrary BlockIx where arbitrary = BlockIx <$> positive <*> positive <*> positive -- cgit v1.2.3