Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ public Bytes<U> clear()
}

/**
* Clears the buffer then advances both cursors by {@code length} bytes
* Clears the buffer and advances both cursors by {@code length} bytes
* leaving space at the start.
*
* @throws BufferOverflowException if {@code start() + length > capacity()}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public static void parseUtf8(@NotNull BytesStore<?, ?> bs, StringBuilder sb, boo
}

/**
* Adjusts the logical length of {@code sb}. For {@link Bytes} this moves the
* Adjusts the logical length of {@code sb}. For {@link Bytes} it moves the
* write position to {@code newLength}.
*/
public static void setLength(@NotNull Appendable sb, @NonNegative int newLength)
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/net/openhft/chronicle/bytes/algo/XxHash.java
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,11 @@ public long applyAsLong(BytesStore<?, ?> bytes) {
*/
@Override
public long applyAsLong(BytesStore<?, ?> bytes, @NonNegative long length) throws IllegalStateException, BufferUnderflowException {
if (length < 0 || length > bytes.readRemaining())
throw new BufferUnderflowException();

long hash;
long remaining = length;
if (remaining < 0 || length > bytes.readRemaining())
throw new BufferUnderflowException();
long off = bytes.readPosition();

if (remaining >= 32) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import org.junit.jupiter.api.Test;

import java.lang.reflect.Field;
import java.util.Arrays;

import static org.mockito.Mockito.*;
import static org.junit.jupiter.api.Assertions.*;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public void currentTimeMicrosPerf() {
} while ((end = System.currentTimeMillis()) < start + 500);
long rate = 1000L * count / (end - start);
System.out.printf("currentTimeMicrosPerf count/sec: %,d%n", rate);
assertTrue(count > 128_000 / 2); // half the speed of Rasberry Pi
assertTrue(count > 128_000 / 2); // half the speed of Raspberry Pi
}

@Test
Expand All @@ -88,7 +88,7 @@ public void currentTimeNanosPerf() {
} while ((end = System.currentTimeMillis()) < start + 500);
long rate = 1000L * count / (end - start);
System.out.printf("currentTimeNanosPerf count/sec: %,d%n", rate);
assertTrue(count > 202_000 / 2); // half the speed of Rasberry Pi
assertTrue(count > 202_000 / 2); // half the speed of Raspberry Pi
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@
import net.openhft.chronicle.bytes.internal.CommonMappedBytes;
import net.openhft.chronicle.core.Jvm;
import net.openhft.chronicle.core.OS;
import net.openhft.chronicle.core.io.BackgroundResourceReleaser;
import org.junit.Before;
import org.junit.Test;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.nio.BufferOverflowException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.FileSystemException;
import java.nio.file.Files;

import static org.junit.Assert.assertEquals;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public void currentTimeMillisPerf() {
count += 1000;
} while (System.currentTimeMillis() < start + 500);
System.out.println("currentTimeMillisPerf count/sec: " + count * 2);
assertTrue(count > 1_000_000 / 2); // half the speed of Rasberry Pi
assertTrue(count > 1_000_000 / 2); // half the speed of Raspberry Pi
}

@Test
Expand All @@ -78,7 +78,7 @@ public void nanoTimePerf() {
count += 1000;
} while (System.currentTimeMillis() < start + 500);
System.out.println("nanoTimePerf count/sec: " + count * 2);
assertTrue(count > 800_000 / 2); // half the speed of Rasberry Pi
assertTrue(count > 800_000 / 2); // half the speed of Raspberry Pi
}

@Test
Expand All @@ -92,7 +92,7 @@ public void currentTimeMicrosPerf() {
count += 1000;
} while (System.currentTimeMillis() < start + 500);
System.out.println("currentTimeMicrosPerf count/sec: " + count * 2);
assertTrue(count > 230_000 / 2); // half the speed of Rasberry Pi
assertTrue(count > 230_000 / 2); // half the speed of Raspberry Pi
}

@Test
Expand All @@ -106,7 +106,7 @@ public void currentTimeNanosPerf() {
count += 1000;
} while (System.currentTimeMillis() < start + 500);
System.out.println("currentTimeNanosPerf count/sec: " + count * 2);
assertTrue(count > 320_000 / 2); // half the speed of Rasberry Pi
assertTrue(count > 320_000 / 2); // half the speed of Raspberry Pi
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;
import java.util.function.Predicate;

import static org.junit.Assume.assumeFalse;
import static org.mockito.Mockito.*;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
*/
package net.openhft.chronicle.bytes;

import net.openhft.chronicle.bytes.Bytes;
import net.openhft.chronicle.bytes.BytesStore;
import net.openhft.chronicle.bytes.UncheckedBytes;
import net.openhft.chronicle.core.pool.ClassAliasPool;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

import net.openhft.chronicle.bytes.Bytes;
import net.openhft.chronicle.bytes.BytesStore;
import net.openhft.chronicle.bytes.util.AbstractInterner;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import net.openhft.chronicle.bytes.StopCharsTester;
import org.junit.Test;
import org.junit.Before;
import static org.mockito.Mockito.*;
import static org.junit.Assert.*;

public class EscapingStopCharsTesterTest {
Expand Down