Address review comments; Add documentation; Shared buffering mechanism for input and output streams

This commit is contained in:
Zahary Karadjov 2020-04-29 21:19:18 +03:00
commit b24300bd3f
No known key found for this signature in database
GPG key ID: C8936F8A3073D609
24 changed files with 2396 additions and 1060 deletions

View file

@ -1,3 +1,5 @@
{.used.}
import
std/[unittest, strutils, base64],
../faststreams/pipelines,
@ -13,7 +15,7 @@ type
proc upcaseAllCharacters(i: InputStream, o: OutputStream) =
while i.readable:
o.append toUpperAscii(char i.read())
o.write toUpperAscii(char i.read())
template timeit(timerVar: var Nanos, code: untyped) =
let t0 = getTicks()
@ -40,7 +42,7 @@ suite "pipelines":
timeIt times.fsPipeline:
var memOut = memoryOutput()
executePipeline(memoryInput(loremIpsum),
executePipeline(unsafeMemoryInput(loremIpsum),
upcaseAllCharacters,
base64encode,
base64decode,