首页 > 解决方案 > 运行 N 个函数与 1 个组合函数

问题描述

在下面的视频Thinking Parallel Programming中,Guy Steele 最后推荐了提高代码性能的方法

他在 1:01 左右提到,如果你有一个状态 s 和函数数组 f[i],那么与其做

for i <- 1 to n; s = f[i](s)

fcomposed(s) where fcomposed is the composition of all functions in f[i]

我在这里看不到任何好处。我误解了什么吗?

标签: parallel-processingfunctional-programmingcomposition

解决方案


推荐阅读