-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#12 #48 WcApp implementation using ZStream #64
Conversation
7815195
to
886a04a
Compare
886a04a
to
0673507
Compare
wordsStream <- if (opts.words) words.optional else ZIO.none | ||
linesStream <- if (opts.lines) lines.optional else ZIO.none | ||
|
||
bytesFiber <- runCountOrNone(bytesStream).fork |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately you will read the file 4 times. I think you want 4 transducers, each of them doing word / character / line / byte count, and then glue them together, and stick them on the stream. That would be much more efficient than reading the file 4 separate times.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do ZTransducer
compose in that way? There is not zip
on ZTransducer
s. But I get your point there. I'll implement it using ZSink
s. One for each optional count and then zipping them and apply it on the stream.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's unfortunate they don't compose (although they can). So yes, I think switching to using ZSink is a good idea.
5a018d7
to
4a251f5
Compare
@TobiasPfeifer Great work! So nice to see a full-fledged and working example app written using ZIO CLI. |
#12 #48
@jdegoes @iravid for files larger than 1MB this implementation is consuming 100% CPU for way to long. Can you check if there is a flaw in my implementation. Otherwise this is indicating a performance issue in ZStreams