Skip to content

Commit

Permalink
One minor tweak to only sort the range of data we have in the buffer,…
Browse files Browse the repository at this point in the history
… if its not full we only need to sort from 0 to index.
  • Loading branch information
Steven Warwick committed Jul 18, 2019
1 parent 08dbe71 commit 9965399
Showing 1 changed file with 1 addition and 1 deletion.
Expand Up @@ -93,7 +93,7 @@ public boolean isEmpty() {

private void sort(){
//Arrays.sort is not the best variant here because it allocates TimSort class and array into it every time.
Arrays.sort(data, (o1, o2) -> {
Arrays.sort(data, 0, full ? data.length : index, (o1, o2) -> {
long sequence1 = o1.getMsgSeqNum();
long sequence2 = o2.getMsgSeqNum();
return Long.compare(sequence1, sequence2);
Expand Down

0 comments on commit 9965399

Please sign in to comment.