Scala actors: receive vs react

前端 未结 5 1060
醉话见心
醉话见心 2020-12-12 11:14

Let me first say that I have quite a lot of Java experience, but have only recently become interested in functional languages. Recently I\'ve started looking at Scala, which

5条回答
  •  再見小時候
    2020-12-12 11:39

    I haven't done any major work with scala /akka, however i understand that there is a very significant difference in the way actors are scheduled. Akka is just a smart threadpool which is time slicing execution of actors... Every time slice will be one message execution to completion by an actor unlike in Erlang which could be per instruction?!

    This leads me to think that react is better as it hints the current thread to consider other actors for scheduling where as receive "might" engage the current thread to continue executing other messages for the same actor.

提交回复
热议问题