performance penalty of message passing as opposed to shared data

后端 未结 7 2343
梦谈多话
梦谈多话 2021-02-15 12:38

There is a lot of buzz these days about not using locks and using Message passing approaches like Erlang. Or about using immutable datastructures like in Functional programming

7条回答
  •  遇见更好的自我
    2021-02-15 13:03

    For correctness, shared is the way to go, and keep the data as normalized as possible. For immediacy, send messages to inform of changes, but always back them up with polling. Messages get dropped, duplicated, re-ordered, delayed - don't rely on them.

    If speed is what you're worried about, first do it single-thread and tune the daylights out of it. Then if you've got multiple cores and know how to split up the work, use parallelism.

提交回复
热议问题