ByteBufIndexOfBenchmark Class — netty Architecture
Architecture documentation for the ByteBufIndexOfBenchmark class in ByteBufIndexOfBenchmark.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 257f6167_b14b_a54e_7391_cd43ee4075f6["ByteBufIndexOfBenchmark"] 54900dfd_b442_e08d_032a_9053adb81611["ByteBufIndexOfBenchmark.java"] 257f6167_b14b_a54e_7391_cd43ee4075f6 -->|defined in| 54900dfd_b442_e08d_032a_9053adb81611 cf82c440_e22a_79f1_9dab_e93f23b8fd67["init()"] 257f6167_b14b_a54e_7391_cd43ee4075f6 -->|method| cf82c440_e22a_79f1_9dab_e93f23b8fd67 1df6bbd1_ac40_f8ed_8e0b_a0dd85f063e8["ByteBuf()"] 257f6167_b14b_a54e_7391_cd43ee4075f6 -->|method| 1df6bbd1_ac40_f8ed_8e0b_a0dd85f063e8 2312613a_860e_62c0_feb1_537823c4d8e9["indexOf()"] 257f6167_b14b_a54e_7391_cd43ee4075f6 -->|method| 2312613a_860e_62c0_feb1_537823c4d8e9 152c95b2_84ca_e192_8ee2_0c98e01af425["releaseBuffers()"] 257f6167_b14b_a54e_7391_cd43ee4075f6 -->|method| 152c95b2_84ca_e192_8ee2_0c98e01af425
Relationship Graph
Source Code
microbench/src/main/java/io/netty/microbench/buffer/ByteBufIndexOfBenchmark.java lines 38–134
@State(Scope.Benchmark)
@OutputTimeUnit(TimeUnit.MICROSECONDS)
@Fork(2)
@Warmup(iterations = 5, time = 1)
@Measurement(iterations = 8, time = 1)
public class ByteBufIndexOfBenchmark extends AbstractMicrobenchmark {
@Param({
"7",
"16",
"23",
"32",
})
int size;
@Param({
"4",
"11",
})
int logPermutations;
@Param({
"1",
})
int seed;
int permutations;
ByteBuf[] data;
private int i;
@Param({
"0",
})
private byte needleByte;
@Param({
"true",
"false",
})
private boolean direct;
@Param({
"true",
"false",
})
private boolean noUnsafe;
@Param({
"true",
"false",
})
private boolean pooled;
@Setup(Level.Trial)
public void init() {
System.setProperty("io.netty.noUnsafe", Boolean.valueOf(noUnsafe).toString());
SplittableRandom random = new SplittableRandom(seed);
permutations = 1 << logPermutations;
this.data = new ByteBuf[permutations];
final ByteBufAllocator allocator = pooled? PooledByteBufAllocator.DEFAULT : UnpooledByteBufAllocator.DEFAULT;
for (int i = 0; i < permutations; ++i) {
data[i] = direct? allocator.directBuffer(size, size) : allocator.heapBuffer(size, size);
for (int j = 0; j < size; j++) {
int value = random.nextInt(Byte.MIN_VALUE, Byte.MAX_VALUE + 1);
// turn any found value into something different
if (value == needleByte) {
if (needleByte != 1) {
value = 1;
} else {
value = 0;
}
}
data[i].setByte(j, value);
}
final int foundIndex = random.nextInt(Math.max(0, size - 8), size);
data[i].setByte(foundIndex, needleByte);
}
}
private ByteBuf getData() {
Source
Frequently Asked Questions
What is the ByteBufIndexOfBenchmark class?
ByteBufIndexOfBenchmark is a class in the netty codebase, defined in microbench/src/main/java/io/netty/microbench/buffer/ByteBufIndexOfBenchmark.java.
Where is ByteBufIndexOfBenchmark defined?
ByteBufIndexOfBenchmark is defined in microbench/src/main/java/io/netty/microbench/buffer/ByteBufIndexOfBenchmark.java at line 38.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free