Skip to content

Commit

Permalink
chore(jmh): Use larger buffer for incremental update
Browse files Browse the repository at this point in the history
  • Loading branch information
guicamest committed Nov 27, 2023
1 parent 0d838f9 commit 3cf21b5
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ public void digestBlake_inc(Blackhole bh) throws IOException {
bh.consume(blake3.doFinalize(outBytes));
}

final int TRANSFER_BUFFER_SIZE = 16 * 1024;
char[] buffer = new char[TRANSFER_BUFFER_SIZE];
private void forEachBufferIn(byte[] bytes, BiConsumer<byte[], Integer> consumer) throws IOException {
try(var reader = new BufferedReader(new InputStreamReader(new ByteArrayInputStream(bytes)))){
final int TRANSFER_BUFFER_SIZE = 8192;
char[] buffer = new char[TRANSFER_BUFFER_SIZE];
try(var reader = new BufferedReader(new InputStreamReader(new ByteArrayInputStream(bytes)), TRANSFER_BUFFER_SIZE)){
int nRead;
while ((nRead = reader.read(buffer, 0, TRANSFER_BUFFER_SIZE)) >= 0) {
consumer.accept(bytes, nRead);
Expand Down

0 comments on commit 3cf21b5

Please sign in to comment.