Home / Class/ PlatformDependentBenchmark Class — netty Architecture

PlatformDependentBenchmark Class — netty Architecture

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

Entity Profile

Dependency Diagram

graph TD
  1b124df3_fd9b_b6e0_f648_61e0304c0038["PlatformDependentBenchmark"]
  1ec62be3_7a46_40ab_1c53_4dc3ceee6154["PlatformDependentBenchmark.java"]
  1b124df3_fd9b_b6e0_f648_61e0304c0038 -->|defined in| 1ec62be3_7a46_40ab_1c53_4dc3ceee6154
  47b7e5c2_cd64_bde1_6600_884ae47bb9b7["setup()"]
  1b124df3_fd9b_b6e0_f648_61e0304c0038 -->|method| 47b7e5c2_cd64_bde1_6600_884ae47bb9b7
  30d148df_bb02_3ea0_b523_2ec46d510f94["unsafeBytesEqual()"]
  1b124df3_fd9b_b6e0_f648_61e0304c0038 -->|method| 30d148df_bb02_3ea0_b523_2ec46d510f94
  09601093_1229_ea91_d982_0579d4d5ed89["arraysBytesEqual()"]
  1b124df3_fd9b_b6e0_f648_61e0304c0038 -->|method| 09601093_1229_ea91_d982_0579d4d5ed89

Relationship Graph

Source Code

microbench/src/main/java/io/netty/microbench/internal/PlatformDependentBenchmark.java lines 35–66

@Threads(1)
@State(Scope.Benchmark)
public class PlatformDependentBenchmark extends AbstractMicrobenchmark {

    @Param({ "10", "50", "100", "1000", "10000", "100000" })
    private int size;
    private byte[] bytes1;
    private byte[] bytes2;

    @Setup(Level.Trial)
    public void setup() {
        bytes1 = new byte[size];
        bytes2 = new byte[size];
        for (int i = 0; i < size; i++) {
            bytes1[i] = bytes2[i] = (byte) i;
        }
    }

    @Benchmark
    @BenchmarkMode(Mode.AverageTime)
    @OutputTimeUnit(TimeUnit.NANOSECONDS)
    public boolean unsafeBytesEqual() {
        return PlatformDependent.equals(bytes1, 0, bytes2, 0, bytes1.length);
    }

    @Benchmark
    @BenchmarkMode(Mode.AverageTime)
    @OutputTimeUnit(TimeUnit.NANOSECONDS)
    public boolean arraysBytesEqual() {
        return Arrays.equals(bytes1, bytes2);
    }
}

Frequently Asked Questions

What is the PlatformDependentBenchmark class?
PlatformDependentBenchmark is a class in the netty codebase, defined in microbench/src/main/java/io/netty/microbench/internal/PlatformDependentBenchmark.java.
Where is PlatformDependentBenchmark defined?
PlatformDependentBenchmark is defined in microbench/src/main/java/io/netty/microbench/internal/PlatformDependentBenchmark.java at line 35.

Analyze Your Own Codebase

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

Try Supermodel Free