Hello! Does stdlib contains function for generatin...
# stdlib
p
Hello! Does stdlib contains function for generating hash code by several arguments?
j
🙏 1
e
Copy code
arrayOf(foo, bar, baz).contentHashCode()
1
🙏 2
j
When I was at Google I was trying to get R8 to eliminate array allocations like that which don't escape. I should revive that branch.
Relies on
contentHashCode()
being
inline
or inlined
We saw a decent amount of code like
if (thing in arrayOf(foo, bar))
that it was targeting, but it'd also be good for this
e
ah, that would be nice. at least
contentHashCode()
is inline - Objects.hash() isn't, so there's probably no getting around the varargs array construction for that
i
contentHashCode
is inline just because it delegates to
Arrays.hashCode