DEV Community

loading...

Discussion on: Keeping Your Code Simple

Collapse
buinauskas profile image
Evaldas

Seems that sort has worse performance compared to reduce. Reduce is O(n) while sort is O(n long)

Thread Thread
lexlohr profile image
Alex Lohr

Yes, the performance is worse. But unless you need the solution to scale to arrays with more than a few thousand words, this will hardly be an issue.

Thread Thread
buinauskas profile image
Evaldas

True. Just wrote that because it wasn't mentioned anywhere and someone might care about it.

Thread Thread
themightyt_v3 profile image
theMightiestT

valid point but I agree with Alex... not sure it would really be a thing in an implementation like this