短评 · ·

X 归档 2024-05-02

1 条动态 · 图 0 · 视频 0
The nice part about this is you can write nice functional code that iterates on collections (map, filter etc.) with hand-optimized-level performance.

Every time I use map/filter in JS instead of plain for loops I feel like voluntarily giving up performance.
这样做的妙处在于,你可以写出优雅的函数式代码来遍历集合(map、filter 等),同时获得手工优化级别的性能。

每当我在 JS 里用 map/filter 而不是朴素的 for 循环时,都感觉是在主动放弃性能。