scalaz/scalaz-stream — pull request #108 by fthomas (2014-02-13 17:30:02+00:00)
Title: Improving performance of dropLastIf and last

While I was profiling `utf8Decode`, I noticed that `dropLastIf` has a severe impact on the performance of `utf8Decode`. It slowed the whole process down by a factor of 2 to 3. I did then some [micro benchmarks] of `dropLastIf` and `last` and different implementations of those that do not use `awaitOption`. Here are the [results]. The performance improvements are noticeable; if you believe the numbers, they are about 20 percent faster than the current implementations. I'm therefore proposing these new implementations in this PR.

[micro benchmarks]: https://github.com/fthomas/scalaz-stream/blob/benchmarks/src/test/scala/scalaz/stream/performance/Process1Perf.scala
[results]: https://github.com/fthomas/scalaz-stream/blob/benchmarks/src/test/scala/scalaz/stream/performance/results.txt