Each Second Counts, or Not
¶ by !undefinedThe moral of the story here is to think simple when trying to optimize code, otherwise we end up going to far into optimizing and actually make the code more complex and likely slower, but this does not mean that the code with the fewest characters or lines will be the quickest.
In other words: optimize for… (a) speed of execution? or (b) size and download speed? or (c) readability?
UPDATED: Consider this quoted tweet by Ryan Florence:
T | F – In #JavaScript, 90% of the time we do stuff only a few times, maybe hundreds. Therefore, 90% of the time Readability > Performance.
And as we know from our casual Array
research, you need to do something a lot of times for the micro-optimizations to be really meaningful.
Leave a Reply