DEV Community

Discussion on: Laravel collection methods vs loops

Collapse
 
lcjury profile image
luis jury senn

It will have a performance hit as you're using functional methods instead of modifying arrays inplace.

Anyway, does the performance hit matters?, I been using Laravel for years, I haven written traditionals-for-loops in a while, and, if any time in the future your app has a performance problem, you can pay 10 extra dollars to add an extra server.

Your development time is way more expensive than some CPU.

If you find collections easier to maintain and test (I do), then it completely worth it.

Collapse
 
on3ss profile image
on3ss

Tradeoffs as always but i guess if the performance hit isn't so noticeable then maintainable code is a no brainer.

Collapse
 
futureistaken profile image
R Z

It's fair enough if a website has, for example, 500 users per day. What about a million or more? I am not sure that the 10 dollars you set aside for ice cream will be enough.