for、for each、map、reduce、filter、find性能比较

时间:2021-1-8 作者:admin

Personally I love map, reduce, filter, find and I am using them from a long time. They helped me write clean, precise, fast and to the point code which align with my thought process. I use for loop when i have no choice left. As far as optimisation is concerned, map/reduce/filter/find replacement should be the the last option or not an option depending upon what level of optimisation is required.

Note: If you’re using loops, always use them idiomatically since compilers are now smart enough to correctly optimize idiomatic loops

I am happy to receive any feedback may be positive or negative.

Update: Here you can find the result for large data set and heavy computation.