RFR: 8221836: Avoid recalculating String.hash when zero
claes.redestad at oracle.com
Mon Apr 8 16:26:51 UTC 2019
not sure that would be an optimization, since you'd trade a conditional
write for an unconditional one. The computation itself for the empty
string has trivial cost.
On 2019-04-08 18:12, Ivan Gerasimov wrote:
> Hi Claes!
> Would it make sense to preset hashIsZero = true in the empty string
> The current code avoids calculating the hashCode for an empty string,
> and the new code doesn't seem to do that because hashIsZero = false by
> default for each newly constructed copy of the empty string.
> With kind regards,
More information about the core-libs-dev