1)我们知道,map() 和reduce() 没有副作用.如今,我们在手机上也有多核.那么使用它们是否更有效?
1)As we know, there's no side-effect with map() and reduce(). Nowadays, we also have muti-core on cell phone. So is it more efficient to use them?
2)另一方面,在大多数浏览器上只有一个 js 线程可以执行.所以map()和reduce()是为服务端脚本准备的?
2)On the other hand, there's only 1 thread for js to execute on most of the browsers. Therefor map() and reduce() are prepared for server-side scripting?
这很容易被忽视,但获得 MapReduce 好处的关键在于
It is easily overlooked, but the key to getting the benefits of MapReduce is to
A) 利用优化的随机播放.通常,您的 map 和 reduce 函数可以用慢速语言实现,只要 shuffle(最昂贵的操作)得到很好的优化,它仍然是快速且可扩展的.
A) Exploit the optimized shuffle. Often, your map and reduce functions can be implemented in a slow language, as long as the shuffle - the most expensive operation - is well optimized, it will still be fast and scalable.
B) 利用检查点功能从节点故障中恢复(但希望您的 CPU 内核不会出现故障).
B) Exploit the checkpointing functionality to recover from node failures (but hopefully, your CPU cores won't fail).
所以说到底,map-reduce 实际上既不是 map,也不是 reduce 函数.这是关于它周围的框架;即使使用糟糕的map"和reduce"功能,它也会为您提供良好的性能(除非您在 shuffle 步骤中失去对数据集大小的控制!).
So in the end, map-reduce is actually neither about the map, nor the reduce functions. It's about the framework around it; which will give you good performance even with bad "map" and "reduce" functions (unless you lose control over your data set size in the shuffle step!).
在单个节点上执行多线程 map-reduce 所获得的收益相当低,并且很可能有 比 map-reduce 更好的方法来为共享内存架构并行化您的商店强>...
The gains to be obtained from doing a multi-threaded map-reduce on a single node are fairly low, and most likely there are much better ways of parallelizing your shop for shared memory architectures than map-reduce...
不幸的是,现在围绕 mapreduce 有很多炒作(而且理解太少).如果您查找 原始论文,它会详细介绍备份任务"、机器故障"和局部优化"(对于内存中的单主机用例,这两者都没有意义).
Unfortunately, there is a lot of hype (and too little understanding) surrounding mapreduce these days. If you look up the original paper, it goes into detail about "Backup Tasks", "Machine Failures" and "locality optimization" (neither of which makes sense for an in-memory single-host use case).
仅仅因为它有一个map"和一个reduce"并不能使它成为一个mapreduce".
如果它具有优化的随机播放、节点崩溃和落后者恢复,则它只是一个 MapReduce.
Just because it has a "map" and a "reduce" doesn't make it a "mapreduce" yet.
It's only a MapReduce if it has an optimized shuffle, node crash and straggler recovery.
这篇关于对于 Array,使用 map() & 是否更有效?在javascript中减少()而不是forEach()?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!