A missing optimization for simple loops

Martin Grajcar maaartinus at gmail.com
Sat Jun 14 19:43:48 UTC 2014

A simple loop like in String.hashCode could be sped up by a factor of
nearly 4, if its operations would be rearranged slightly. The problem is
the latency of the iteration (mul+add, i.e., 4 cycles), which can't be
helped by unrolling because of data dependencies. But with the help of some
trivial math it's possible as I described in [1]. Does anybody think it's
worth the effort?

[1]: http://stackoverflow.com/q/21745619/581205
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/attachments/20140614/fb7f075c/attachment.html>

More information about the hotspot-compiler-dev mailing list