Github user kiszk commented on the issue:
https://github.com/apache/spark/pull/22338
@mgaido91 thanks, interestingly I did experiments with similar code in my
box.
While I am using the linux box, I can confirm the performance improvement
(or performance recover).
Regarding bytecode size, what I have seen in my experiments is the
following. I have not found the root cause of this behavior.
Your original code: 38us
```
public static int hashUnsafeBytesBlock(MemoryBlock base, int seed) {
return hashUnsafeBytesBlock(base, Ints.checkedCast(base.size()), seed);
}
private static int hashUnsafeBytesBlock(MemoryBlock base, int
lengthInBytes, int seed) {
// This is not compatible with original and another implementations.
// But remain it for backward compatibility for the components existing
before 2.3.
assert (lengthInBytes >= 0): "lengthInBytes cannot be negative";
int lengthAligned = lengthInBytes - lengthInBytes % 4;
....
```
Your original code with moving `checkedCast`: 112us
```
public static int hashUnsafeBytesBlock(MemoryBlock base, int seed) {
// return hashUnsafeBytesBlock(base, Ints.checkedCast(base.size()),
seed);
return hashUnsafeBytesBlock(base, -1, seed);
}
private static int hashUnsafeBytesBlock(MemoryBlock base, int
lengthInBytes, int seed) {
// This is not compatible with original and another implementations.
// But remain it for backward compatibility for the components existing
before 2.3.
lengthInBytes = Ints.checkedCast(base.size());
assert (lengthInBytes >= 0): "lengthInBytes cannot be negative";
int lengthAligned = lengthInBytes - lengthInBytes % 4;
...
```
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]