Unless I’m up against the wall on a performance issue, I prefer to code optimistically, and keep performance tweaks that make my code less attractive in my back pocket in case I need them. It’s also worth considering that using methods such as map() and reduce() may take better advantage of improvements in the JavaScript engine as browsers optimize for them in the future. My approach is usually to write code for readability and maintainability first, and then optimize for performance if I notice issues in real world situations. Currently browsers do perform more efficiently using more cumbersome traditional techniques, such as for loops. Of course, reading and maintaining your code has to be balanced against performance when the situation calls for it. Mapping and reducing can make your code much cleaner and more easy to read and maintain, and put you on a path toward more elegant functional development. Most contemporary JavaScript platforms support ECMAScript 5 natively. If you’re not using map() and reduce() today, it’s time you started.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |