By Alvin Alexander. Last updated: January 25, 2026
| this post is sponsored by my books: | |||
#1 New Release |
FP Best Seller |
Learn Scala 3 |
Learn FP Fast |
In this ZIO performance tuning article by Pierre Ricadat, there’s this nice tip (shown in the image) about using ZIO.foreachDiscard instead of ZIO.foreach:
“One of ZIO's common operators is ZIO.foreach, which allows you to run an effect for each item in a collection. There's also ZIO.foreachDiscard that is faster if you don't need to collect results (e.g., if your effect returns Unit).”
For more details, see that article.
