DEV Community

Discussion on: Not an "Easy" Algorithm: Rotating an Array, Three Ways

 
miketalbot profile image
Mike Talbot ⭐

It's probably the game programmer in me coming out. Don't allocate things because something has to garbage collect them later. That takes time, causes glitches etc.

I wrote the below a while ago about this. It really doesn't matter if you are sure the code isn't going to work on giant data or be called frequently. If that is the case then my "dont allocate/copy/garbage collect" OCD kicks in :)