dweiss commented on code in PR #12778:
URL: https://github.com/apache/lucene/pull/12778#discussion_r1384432877
##########
lucene/core/src/test/org/apache/lucene/util/TestByteBlockPool.java:
##########
@@ -25,7 +24,34 @@
public class TestByteBlockPool extends LuceneTestCase {
- public void testReadAndWrite() throws IOException {
+ public void testAppendFromOtherPool() {
+ ByteBlockPool pool = new ByteBlockPool(new
ByteBlockPool.DirectAllocator());
+ final int numBytes = atLeast(2 << 16);
+ byte[] bytes = new byte[numBytes];
+ for (int i = 0; i < numBytes; i++) {
+ bytes[i] = (byte) random().nextInt(256);
Review Comment:
The test will be faster if you pull random() outside of the loop or - even
better - create a local new Random(random().nextLong()) and use that in the
loop.
Alternatively, take a look at RandomBytes.randomBytesOfLength()...
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]