News for hackers. Stuff that matters.
Re:Simple apply/filter/reduce package in Go by pcwalton on Friday April 03, 2015 @11:41AM (#9316460)
> In most languages, the for loop ends up being faster. Sometimes noticeably so. Me, I generally start with declarative syntax, but the profiler frequently tells me to go back and change it.

The optimization techniques to make higher-order functions compile down into the same code as a for loop are well-known. All you have to do is inline, constant propagate, and maybe SROA. Every optimizing compiler I know of, even JavaScript, has no problem doing this.

Re:Simple apply/filter/reduce package in Go by Veedrac on Tuesday April 07, 2015 @01:50AM (#9332213)
FWIW, PyPy has a hard time with this since Python's iterators are really heavyweight.