Home / Function/ setup() — netty Function Reference

setup() — netty Function Reference

Architecture documentation for the setup() function in ByteBufUtilBenchmark.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  5ba46e0e_d916_0e3c_d091_198c653f2ba5["setup()"]
  794c8128_05d5_9b68_be2d_470f54884c21["ByteBufUtilBenchmark"]
  5ba46e0e_d916_0e3c_d091_198c653f2ba5 -->|defined in| 794c8128_05d5_9b68_be2d_470f54884c21
  style 5ba46e0e_d916_0e3c_d091_198c653f2ba5 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

microbench/src/main/java/io/netty/microbench/buffer/ByteBufUtilBenchmark.java lines 62–85

    @Setup
    public void setup() {
        // Use buffer sizes that will also allow to write UTF-8 without grow the buffer
        final int maxBytes = ByteBufUtil.utf8MaxBytes(length);
        buffer = direct? Unpooled.directBuffer(maxBytes) : Unpooled.buffer(maxBytes);
        wrapped = Unpooled.unreleasableBuffer(direct? Unpooled.directBuffer(maxBytes) : Unpooled.buffer(maxBytes));
        asciiSequence = new StringBuilder(length);
        for (int i = 0; i < length; i++) {
            asciiSequence.append('a');
        }
        ascii = asciiSequence.toString();

        // Generate some mixed UTF-8 String for benchmark
        utf8Sequence = new StringBuilder(length);
        char[] chars = "Some UTF-8 like äÄ∏ŒŒ".toCharArray();
        for (int i = 0; i < length; i++) {
            utf8Sequence.append(chars[i % chars.length]);
        }
        utf8 = utf8Sequence.toString();
        asciiSequence = utf8Sequence;

        asciiBuffer = Unpooled.copiedBuffer(ascii, CharsetUtil.US_ASCII);
        utf8Buffer = Unpooled.copiedBuffer(utf8, CharsetUtil.UTF_8);
    }

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free