Home / Function/ init() — netty Function Reference

init() — netty Function Reference

Architecture documentation for the init() function in ByteBufIndexOfBenchmark.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  cf82c440_e22a_79f1_9dab_e93f23b8fd67["init()"]
  257f6167_b14b_a54e_7391_cd43ee4075f6["ByteBufIndexOfBenchmark"]
  cf82c440_e22a_79f1_9dab_e93f23b8fd67 -->|defined in| 257f6167_b14b_a54e_7391_cd43ee4075f6
  style cf82c440_e22a_79f1_9dab_e93f23b8fd67 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

microbench/src/main/java/io/netty/microbench/buffer/ByteBufIndexOfBenchmark.java lines 92–116

    @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);
        }
    }

Domain

Subdomains

Frequently Asked Questions

What does init() do?
init() is a function in the netty codebase, defined in microbench/src/main/java/io/netty/microbench/buffer/ByteBufIndexOfBenchmark.java.
Where is init() defined?
init() is defined in microbench/src/main/java/io/netty/microbench/buffer/ByteBufIndexOfBenchmark.java at line 92.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free