Home / Class/ ByteBufCopy2Benchmark Class — netty Architecture

ByteBufCopy2Benchmark Class — netty Architecture

Architecture documentation for the ByteBufCopy2Benchmark class in ByteBufCopy2Benchmark.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  81c20198_34cc_f06b_0cec_a1d94ae33134["ByteBufCopy2Benchmark"]
  344d89c0_8ce4_69b4_9015_ec349ebed85b["ByteBufCopy2Benchmark.java"]
  81c20198_34cc_f06b_0cec_a1d94ae33134 -->|defined in| 344d89c0_8ce4_69b4_9015_ec349ebed85b
  7c9caa26_fdc4_1d04_384d_ce7edaed5864["setup()"]
  81c20198_34cc_f06b_0cec_a1d94ae33134 -->|method| 7c9caa26_fdc4_1d04_384d_ce7edaed5864
  eb1c80b6_238e_f484_be50_a66d36cae035["ByteBuf()"]
  81c20198_34cc_f06b_0cec_a1d94ae33134 -->|method| eb1c80b6_238e_f484_be50_a66d36cae035
  6d641ead_f010_3308_4b14_98eb71af0fd3["tearDown()"]
  81c20198_34cc_f06b_0cec_a1d94ae33134 -->|method| 6d641ead_f010_3308_4b14_98eb71af0fd3

Relationship Graph

Source Code

microbench/src/main/java/io/netty/microbench/buffer/ByteBufCopy2Benchmark.java lines 26–71

public class ByteBufCopy2Benchmark extends AbstractMicrobenchmark {
    static {
        System.setProperty("io.netty.buffer.bytebuf.checkAccessible", "false");
    }

    @Param({
            "7",
            "36",
            "128",
            "512",
    })
    private int size;

    @Param({
            "true",
            "false",
    })
    private boolean directByteBuf;

    private ByteBuf buffer1;
    private ByteBuf buffer2;

    @Setup
    public void setup() {
        buffer1 = directByteBuf ?
                ByteBufAllocator.DEFAULT.directBuffer(size, size) :
                ByteBufAllocator.DEFAULT.heapBuffer(size, size);
        buffer2 = directByteBuf ?
                ByteBufAllocator.DEFAULT.directBuffer(size, size) :
                ByteBufAllocator.DEFAULT.heapBuffer(size, size);
        for (int i = 0; i < size; i++) {
            buffer2.setByte(i, 0xA5);
        }
    }

    @Benchmark
    public ByteBuf setBytes() {
        return buffer1.setBytes(0, buffer2, 0, size);
    }

    @TearDown
    public void tearDown() {
        buffer1.release();
        buffer2.release();
    }
}

Frequently Asked Questions

What is the ByteBufCopy2Benchmark class?
ByteBufCopy2Benchmark is a class in the netty codebase, defined in microbench/src/main/java/io/netty/microbench/buffer/ByteBufCopy2Benchmark.java.
Where is ByteBufCopy2Benchmark defined?
ByteBufCopy2Benchmark is defined in microbench/src/main/java/io/netty/microbench/buffer/ByteBufCopy2Benchmark.java at line 26.

Analyze Your Own Codebase

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

Try Supermodel Free