Home / Function/ init() — netty Function Reference

init() — netty Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  ad0576e5_9958_be08_cf41_b733d4bf1e4f["init()"]
  3a08a637_e082_6886_6873_1e3a50d44451["ByteBufLastIndexOfBenchmark"]
  ad0576e5_9958_be08_cf41_b733d4bf1e4f -->|defined in| 3a08a637_e082_6886_6873_1e3a50d44451
  style ad0576e5_9958_be08_cf41_b733d4bf1e4f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

microbench/src/main/java/io/netty/microbench/buffer/ByteBufLastIndexOfBenchmark.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(0, Math.min(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/ByteBufLastIndexOfBenchmark.java.
Where is init() defined?
init() is defined in microbench/src/main/java/io/netty/microbench/buffer/ByteBufLastIndexOfBenchmark.java at line 92.

Analyze Your Own Codebase

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

Try Supermodel Free