News for hackers. Stuff that matters.
Re:Zio: Type-safe, composable asynchronous and concurrent pr... by dwohnitmok on Thursday February 11, 2021 @11:17AM (#26103290)
Scala's Futures constantly dip back into their ExecutionContext even when unnecessary; basically every single method on a Future causes it to go back to the ExecutionContext. This means they can incur bookkeeping or at worst thread switching overhead for no good reason.

For example, `map`ping over a completed Future has absolutely no need to go back to the ExecutionContext. Even `flatMap`ping multiple Futures together doesn't necessarily need an ExecutionContext if you offer a separate API to allow `Future`s to switch between threads (this also means that Futures must be delayed and can't run immediately).

These are the big things that make things like ZIO and cats-effect IO faster (there are then other smaller things that differentiate those two from each other).

There are no comments on this comment yet.