我应该使用 akka.http.scaladsl.util.FastFuture 而不是 scala.concurrent.Future 吗?
Should I use akka.http.scaladsl.util.FastFuture instead of scala.concurrent.Future?
我应该使用 akka.http.scaladsl.util.FastFuture 而不是 scala.concurrent.Future 吗?
评论说:
/**
* Provides alternative implementations of the basic transformation operations defined on [[scala.concurrent.Future]],
* which try to avoid scheduling to an [[scala.concurrent.ExecutionContext]] if possible, i.e. if the given future
* value is already present.
*/
我有没有得到任何性能提升,尤其是当我需要使用
Future.apply
、Future.successful
或 Future.failed
?
这两种实现方式到底有什么区别?
基本上 FastFuture
允许绕过 Future
提交给 ExecutionContext
,以防未来已经完成(无论成功与否)。
简而言之,是的,它可以提高性能。这些是微不足道的还是实质性的,取决于您正在开发的应用程序。
我相信有计划将这些改进作为 Scala 2.12 的一部分,但我从未听说过这些改进。
我应该使用 akka.http.scaladsl.util.FastFuture 而不是 scala.concurrent.Future 吗?
评论说:
/**
* Provides alternative implementations of the basic transformation operations defined on [[scala.concurrent.Future]],
* which try to avoid scheduling to an [[scala.concurrent.ExecutionContext]] if possible, i.e. if the given future
* value is already present.
*/
我有没有得到任何性能提升,尤其是当我需要使用
Future.apply
、Future.successful
或 Future.failed
?
这两种实现方式到底有什么区别?
基本上 FastFuture
允许绕过 Future
提交给 ExecutionContext
,以防未来已经完成(无论成功与否)。
简而言之,是的,它可以提高性能。这些是微不足道的还是实质性的,取决于您正在开发的应用程序。
我相信有计划将这些改进作为 Scala 2.12 的一部分,但我从未听说过这些改进。