diff options
author | Sam T <pxqr.sta@gmail.com> | 2013-07-03 00:17:16 +0400 |
---|---|---|
committer | Sam T <pxqr.sta@gmail.com> | 2013-07-03 00:17:16 +0400 |
commit | 07a6123d56df03e5d7c40384c87f6c40ae2b5131 (patch) | |
tree | daa508aaccfc5086dbef89bca5ac4a0bb9408ed8 /examples | |
parent | 044672da343dd3139be0c8f95f1fbd45b7546d9c (diff) |
~ 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.
Diffstat (limited to 'examples')
-rw-r--r-- | examples/Main.hs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/examples/Main.hs b/examples/Main.hs index 18cbefe3..edb37975 100644 --- a/examples/Main.hs +++ b/examples/Main.hs | |||
@@ -13,7 +13,7 @@ main = do | |||
13 | 13 | ||
14 | print (contentLayout "./" (tInfo torrent)) | 14 | print (contentLayout "./" (tInfo torrent)) |
15 | 15 | ||
16 | client <- newClient 10 [] | 16 | client <- newClient 2 [] |
17 | swarm <- newLeecher client torrent | 17 | swarm <- newLeecher client torrent |
18 | 18 | ||
19 | storage <- swarm `bindTo` "/tmp/" | 19 | storage <- swarm `bindTo` "/tmp/" |