News for hackers. Stuff that matters.
Re:Making a Go program 70% faster by avoiding common mistakes by thomasahle on Thursday March 17, 2016 @08:43AM (#11303969)
The first one is only necessary in languages where functions can have side effects. Otherwise the compiler can easily deduplicate that for you.

In most cases you would of course still name the result yourself, as to indicate that the function call indeed is the same. However for something very semantic, such as `sum(list)`, maybe the only name you could give it, would be something like `list_sum` anyway.

Re:Making a Go program 70% faster by avoiding common mistakes by sspiff on Thursday March 17, 2016 @08:54AM (#11304006)
> The first one is only necessary in languages where functions can have side effects

To be more precise, it is only necessary in language where all functions can have side effects. Some language (like D) have the ability to mark a function as "pure" (without side effects), which allow the compiler to perform additional optimizations (and purity validation).

Re:Making a Go program 70% faster by avoiding common mistakes by coldtea on Thursday March 17, 2016 @10:57AM (#11304728)
>The first one is only necessary in languages where functions can have side effects.

Which makes it, practically speaking, almost all of them...