3 ms·
Depends how big the arrays are. Looping over a 100 item array 3 times almost always has a negligible performance hit but might be more readable
by goodoldneon 5y ago
Depends how big the arrays are. Looping over a 100 item array 3 times almost always has a negligible performance hit but might be more readable
- tomxor 5y agoSure if your entire program is only one loop that iterates over 100 things that fit in an L1 cache. If you write an entire program with this thinking, a significant program, each of those "negligible performance hits" will usually add up to a poorly performing program. Back in the day people called "optimising" the application of clever algorithms and tricks to squeeze more out of a computer, today we call it ripping all the shitty slow code out of programs because devs couldn't be arsed to write things properly because "computers are fast". </ yes it's a rant, it's why lots of stuff sucks, make nice things pleeease