cfmcgrady commented on PR #2086:
URL:
https://github.com/apache/incubator-celeborn/pull/2086#issuecomment-1805342745
> I found Objects.hash is even several times faster
this is because `Seq` is an implementation of `List`
```scala
// while
startTime = System.nanoTime()
var whileHash = 1
var i = 0
while (i < 5) {
whileHash = 31 * whileHash + state(i).hashCode()
i = i + 1
}
var endTime = System.nanoTime()
println(endTime - startTime)
// while 2
startTime = System.nanoTime()
whileHash = 1
i = 0
while (i < state.length) {
whileHash = 31 * whileHash + state(i).hashCode()
i = i + 1
}
endTime = System.nanoTime()
println(endTime - startTime)
startTime = System.nanoTime()
val objectHash = java.util.Objects.hash(host, rpcPort, pushPort,
fetchPort, replicatePort)
endTime = System.nanoTime()
println(endTime - startTime)
```
3924 vs 1821 vs 29459
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]