ZIO performance tip about foreach, foreachDiscard, foreachPar

In this ZIO performance tuning article by Pierre Ricadat, there’s this nice tip 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.

Photo D8
ZIO performance tip about foreach, foreachDiscard, foreachPar