Home / Class/ SwappedByteBufBenchmark Class — netty Architecture

SwappedByteBufBenchmark Class — netty Architecture

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

Entity Profile

Dependency Diagram

graph TD
  1971f575_0c0c_3a2d_0b8f_0263873ad4b3["SwappedByteBufBenchmark"]
  42175f55_6551_206b_bb5c_830cf87b561f["SwappedByteBufBenchmark.java"]
  1971f575_0c0c_3a2d_0b8f_0263873ad4b3 -->|defined in| 42175f55_6551_206b_bb5c_830cf87b561f
  bb3a0992_1637_2999_3e83_409883a712d7["setup()"]
  1971f575_0c0c_3a2d_0b8f_0263873ad4b3 -->|method| bb3a0992_1637_2999_3e83_409883a712d7
  e88bab1a_6c82_9139_7b86_3173e96a8b08["swappedByteBufSetInt()"]
  1971f575_0c0c_3a2d_0b8f_0263873ad4b3 -->|method| e88bab1a_6c82_9139_7b86_3173e96a8b08
  72e71f4a_d147_9adb_68ef_d0165ae745e3["swappedByteBufSetShort()"]
  1971f575_0c0c_3a2d_0b8f_0263873ad4b3 -->|method| 72e71f4a_d147_9adb_68ef_d0165ae745e3
  3b705579_3af9_0f8f_c74c_be3e8518f6fc["swappedByteBufSetLong()"]
  1971f575_0c0c_3a2d_0b8f_0263873ad4b3 -->|method| 3b705579_3af9_0f8f_c74c_be3e8518f6fc
  bfc0c962_2a53_b237_dcc1_3ee980bd0353["unsafeSwappedByteBufSetInt()"]
  1971f575_0c0c_3a2d_0b8f_0263873ad4b3 -->|method| bfc0c962_2a53_b237_dcc1_3ee980bd0353
  6d3a3205_13ce_95c7_f9e5_f7bf89442e56["unsafeSwappedByteBufSetShort()"]
  1971f575_0c0c_3a2d_0b8f_0263873ad4b3 -->|method| 6d3a3205_13ce_95c7_f9e5_f7bf89442e56
  9d776bd0_7637_a470_d895_7a2d0c079375["unsafeSwappedByteBufSetLong()"]
  1971f575_0c0c_3a2d_0b8f_0263873ad4b3 -->|method| 9d776bd0_7637_a470_d895_7a2d0c079375

Relationship Graph

Source Code

microbench/src/main/java/io/netty/microbench/buffer/SwappedByteBufBenchmark.java lines 32–80

@State(Scope.Benchmark)
@Warmup(iterations = 10)
@Measurement(iterations = 25)
public class SwappedByteBufBenchmark extends AbstractMicrobenchmark {
    private ByteBuf swappedByteBuf;
    private ByteBuf unsafeSwappedByteBuf;

    @Setup
    public void setup() {
        swappedByteBuf = new SwappedByteBuf(Unpooled.directBuffer(8));
        unsafeSwappedByteBuf = Unpooled.directBuffer(8).order(ByteOrder.LITTLE_ENDIAN);
        if (unsafeSwappedByteBuf.getClass().equals(SwappedByteBuf.class)) {
            throw new IllegalStateException("Should not use " + SwappedByteBuf.class.getSimpleName());
        }
    }

    @Param("16384")
    public int size;

    @Benchmark
    public void swappedByteBufSetInt() {
        swappedByteBuf.setLong(0, size);
    }

    @Benchmark
    public void swappedByteBufSetShort() {
        swappedByteBuf.setShort(0, size);
    }

    @Benchmark
    public void swappedByteBufSetLong() {
        swappedByteBuf.setLong(0, size);
    }

    @Benchmark
    public void unsafeSwappedByteBufSetInt() {
        unsafeSwappedByteBuf.setInt(0, size);
    }

    @Benchmark
    public void unsafeSwappedByteBufSetShort() {
        unsafeSwappedByteBuf.setShort(0, size);
    }

    @Benchmark
    public void unsafeSwappedByteBufSetLong() {
        unsafeSwappedByteBuf.setLong(0, size);
    }
}

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free