-
-
Notifications
You must be signed in to change notification settings - Fork 942
Closed
Labels
Milestone
Description
From RubyUDPSocket.java:277
RubyString data = _mesg.convertToString();
ByteBuffer buf = ByteBuffer.wrap(data.getBytes());
byte[] buf2 = data.getBytes();each call to data.getBytes() creates a new byte array with the contents of data and returns it - and the second copy is only needed for multicast sockets - if it is unicast, then it is unused!
This could be optimized to use data.getByteList().unsafeBytes(), and the ByteBuffer(byte[] data, int offset, int length) constructor and the DatagramPacket(byte[] data, int offset, int length) constructor to avoid any copying of the data.
Reactions are currently unavailable