Skip to content

Commit 2675dc0

Browse files
committed
Use ByteBuffer#get(int index, byte[] dst) in Loader.java
* This is an absolute bulk get which does not modify the position, and therefore saves from getting, setting and restoring the position.
1 parent ffeb05d commit 2675dc0

1 file changed

Lines changed: 1 addition & 4 deletions

File tree

templates/java/org/ruby_lang/prism/Loader.java.erb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,7 @@ public class Loader {
5959
int length = buffer.getInt(offset + 4);
6060

6161
byte[] bytes = new byte[length];
62-
int position = buffer.position();
63-
buffer.position(start);
64-
buffer.get(bytes, 0, length);
65-
buffer.position(position);
62+
buffer.get(start, bytes);
6663

6764
constant = loader.bytesToName(bytes);
6865
cache[index] = constant;

0 commit comments

Comments
 (0)