News for hackers. Stuff that matters.
Re:Why is 2 * (i * i) faster than 2 * i * i in Java? by astn on Saturday December 01, 2018 @09:50AM (#18576984)
Yeah, sometimes the compiler unrolls too much and innocent looking one-liner can be compiled into a monstrosity like this:

https://godbolt.org/z/aKtko5

Re:Why is 2 * (i * i) faster than 2 * i * i in Java? by londons_explore on Saturday December 01, 2018 @08:14PM (#18580134)
Are there no compilers which attempt to look at that code, decide 'that looks like 1<<(num-2) when n>=2', and replace the code entirely?

There must be so many examples of bubble sort where quicksort would be better, and other code patterns which can be identified and replaced with something orders of magnitude faster.

Re:Why is 2 * (i * i) faster than 2 * i * i in Java? by pertymcpert on Saturday December 01, 2018 @01:52PM (#18578197)
Is that more performant?