Should I use FastFuture with Akka Http

Akka Http uses FastFuture internally to avoid context switching
A common pattern is to make calls like

Unmarshal(decodedResponse.entity).to[Res]
   .map(..do domething)
  .recover(..do domething)

The map is usually very simple (transforming one case class to another, logging, etc.). Does it make sense to use fast future in these type of calls (again, assuming we are very confident the transformations are non-blocking )

Unmarshal(decodedResponse.entity).to[Res].fast
   .map(..do domething)
  .recover(..do domething)

Hi @eugenemiretsky,

there’s no downside to using it. There will only be an effect if the future you use it on is already completed. In that case, the operations will also be executed immediately.

Johannes

By completed you mean something like Future.successful, or would it also work in the cases where the first Asyn call already returned, and we are doing further map operations on it? (i.e the original example where decodedResponse is a Future returned by an API call )

Not sure what you mean exactly by the “first Async call already returned”. It will run immediately if the Future has already been completed, that can be a Future.successful / Future.failed or any other kind of future that has already been completed.