He-Pin opened a new pull request, #3150: URL: https://github.com/apache/pekko/pull/3150
### Motivation Several places allocate a new array then immediately copy from an existing array using `System.arraycopy`. `java.util.Arrays.copyOf` and `copyOfRange` combine allocation and copy in a single call that the JIT can intrinsify more effectively. ### Modification - `ByteString.scala`: 3 sites (`clearTemp`, `resizeTemp`, `fromArray`) — replace `new Array[Byte]` + `System.arraycopy` with `java.util.Arrays.copyOf` / `copyOfRange` - `ImmutableLongMap.scala`: replace full array copy with `values.clone()` - `SnapshotSerializer.scala`: replace partial copy with `java.util.Arrays.copyOfRange` ### Result Fewer lines, potentially faster due to JIT intrinsification of the combined allocate+copy operation. `ByteString` builder operations benefit most as they are in frequently-called paths. ### Tests - `sbt "actor/compile" "remote/compile" "persistence/compile"` — passed ### References Refs #3136 -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
