News for hackers. Stuff that matters.
Re:Show HN: Chrome Extension to Filter HN Stories by Keyword by alistproducer2 on Tuesday January 24, 2017 @10:07AM (#13471853)
thanks for the suggestions. I tend to avoid forEach because of the memory overhead (adds function calls where not really necessary). I guess I'm old school, but never got around to using includes. It's been on my radar for a while. I've always tried to write code that is as portable as possible, even though now, with evergreen browsers in the lead, it doesn't really matter as much.
Re:Show HN: Chrome Extension to Filter HN Stories by Keyword by nailer on Tuesday January 24, 2017 @10:30AM (#13472086)
Yeah, .forEach() is a new scope. But the better readability is worth the minor performance impact for everything but the most performance-intensive code.
Re:Show HN: Chrome Extension to Filter HN Stories by Keyword by drenvuk on Wednesday January 25, 2017 @09:24PM (#13488209)
It's that kind of thinking that gets us really slow software.
Re:Show HN: Chrome Extension to Filter HN Stories by Keyword by nailer on Thursday January 26, 2017 @07:29AM (#13490767)
"premature optimization is the root of all evil" - Don Knuth

Also old-style for loops in JS fall victim to the last entry effect since people often use them to set up event handlers and wonder why they don't work.