Home / Class/ UnitializedArrayBenchmark Class — netty Architecture

UnitializedArrayBenchmark Class — netty Architecture

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

Entity Profile

Dependency Diagram

graph TD
  20e7a433_e09a_ab9f_8df1_d8607aa2d541["UnitializedArrayBenchmark"]
  e8911b0e_a802_3f07_07f6_564839d976ee["UnitializedArrayBenchmark.java"]
  20e7a433_e09a_ab9f_8df1_d8607aa2d541 -->|defined in| e8911b0e_a802_3f07_07f6_564839d976ee
  5f0c7985_064d_2a60_73a1_8cc034cf602e["setupTrial()"]
  20e7a433_e09a_ab9f_8df1_d8607aa2d541 -->|method| 5f0c7985_064d_2a60_73a1_8cc034cf602e
  9f471593_fa74_9a87_d673_0da88cc7e36c["jvmArgs()"]
  20e7a433_e09a_ab9f_8df1_d8607aa2d541 -->|method| 9f471593_fa74_9a87_d673_0da88cc7e36c
  ba06649b_9eae_55e6_b595_3d0ff812ebe2["allocateInitializedByteArray()"]
  20e7a433_e09a_ab9f_8df1_d8607aa2d541 -->|method| ba06649b_9eae_55e6_b595_3d0ff812ebe2
  9f140f3d_ebee_6cc5_964e_6302c135a1e8["allocateUninitializedByteArray()"]
  20e7a433_e09a_ab9f_8df1_d8607aa2d541 -->|method| 9f140f3d_ebee_6cc5_964e_6302c135a1e8

Relationship Graph

Source Code

microbench/src/main/java/io/netty/microbench/internal/UnitializedArrayBenchmark.java lines 35–73

@Warmup(iterations = 3, time = 1, timeUnit = TimeUnit.SECONDS)
@Measurement(iterations = 3, time = 1, timeUnit = TimeUnit.SECONDS)
@Fork(2)
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
@State(Scope.Benchmark)
public class UnitializedArrayBenchmark extends AbstractMicrobenchmark {

    @Param({ "1", "10", "100", "1000", "10000", "100000" })
    private int size;

    @Setup(Level.Trial)
    public void setupTrial() {
        if (PlatformDependent.javaVersion() < 9) {
            throw new IllegalStateException("Needs Java9");
        }
        if (!PlatformDependent.hasUnsafe()) {
            throw new IllegalStateException("Needs Unsafe");
        }
    }

    @Override
    protected String[] jvmArgs() {
        // Ensure we minimize the GC overhead for this benchmark and also open up required package.
        // See also https://shipilev.net/jvm-anatomy-park/7-initialization-costs/
        return new String[] { "-XX:+UseParallelOldGC", "-Xmx8g", "-Xms8g",
                "-Xmn6g", "--add-opens", "java.base/jdk.internal.misc=ALL-UNNAMED" };
    }

    @Benchmark
    public byte[] allocateInitializedByteArray() {
        return new byte[size];
    }

    @Benchmark
    public byte[] allocateUninitializedByteArray() {
        return PlatformDependent.allocateUninitializedArray(size);
    }
}

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free