ByteBufLastIndexOfBenchmark Class — netty Architecture
Architecture documentation for the ByteBufLastIndexOfBenchmark class in ByteBufLastIndexOfBenchmark.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 3a08a637_e082_6886_6873_1e3a50d44451["ByteBufLastIndexOfBenchmark"] 756781e3_ed2f_1b45_83f0_2fad8bcfb181["ByteBufLastIndexOfBenchmark.java"] 3a08a637_e082_6886_6873_1e3a50d44451 -->|defined in| 756781e3_ed2f_1b45_83f0_2fad8bcfb181 ad0576e5_9958_be08_cf41_b733d4bf1e4f["init()"] 3a08a637_e082_6886_6873_1e3a50d44451 -->|method| ad0576e5_9958_be08_cf41_b733d4bf1e4f 35e42b7b_848b_d42c_9014_b2fca0078fdc["ByteBuf()"] 3a08a637_e082_6886_6873_1e3a50d44451 -->|method| 35e42b7b_848b_d42c_9014_b2fca0078fdc 2dab3060_532d_67ab_e2b6_0059d7eb9780["lastIndexOf()"] 3a08a637_e082_6886_6873_1e3a50d44451 -->|method| 2dab3060_532d_67ab_e2b6_0059d7eb9780 7f313e0f_2dd6_b49a_522e_ee5afcd673f7["releaseBuffers()"] 3a08a637_e082_6886_6873_1e3a50d44451 -->|method| 7f313e0f_2dd6_b49a_522e_ee5afcd673f7
Relationship Graph
Source Code
microbench/src/main/java/io/netty/microbench/buffer/ByteBufLastIndexOfBenchmark.java lines 38–134
@State(Scope.Benchmark)
@OutputTimeUnit(TimeUnit.MICROSECONDS)
@Fork(2)
@Warmup(iterations = 5, time = 1)
@Measurement(iterations = 8, time = 1)
public class ByteBufLastIndexOfBenchmark 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(0, Math.min(8, size));
data[i].setByte(foundIndex, needleByte);
}
}
private ByteBuf getData() {
Source
Frequently Asked Questions
What is the ByteBufLastIndexOfBenchmark class?
ByteBufLastIndexOfBenchmark is a class in the netty codebase, defined in microbench/src/main/java/io/netty/microbench/buffer/ByteBufLastIndexOfBenchmark.java.
Where is ByteBufLastIndexOfBenchmark defined?
ByteBufLastIndexOfBenchmark is defined in microbench/src/main/java/io/netty/microbench/buffer/ByteBufLastIndexOfBenchmark.java at line 38.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free