Home / Class/ NetUtilBenchmark Class — netty Architecture

NetUtilBenchmark Class — netty Architecture

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

Entity Profile

Dependency Diagram

graph TD
  bc5894ee_1dab_8275_b13f_daf1cf478fc8["NetUtilBenchmark"]
  2f60a21b_2312_07c3_0750_fb3409efb910["NetUtilBenchmark.java"]
  bc5894ee_1dab_8275_b13f_daf1cf478fc8 -->|defined in| 2f60a21b_2312_07c3_0750_fb3409efb910
  4b76d17d_0cf7_d2e6_176d_1f6334460c3a["useGetByNameIpv4()"]
  bc5894ee_1dab_8275_b13f_daf1cf478fc8 -->|method| 4b76d17d_0cf7_d2e6_176d_1f6334460c3a
  8125edb3_4d85_25a8_a3bb_0a422a5eed63["useGetByNameIpv6()"]
  bc5894ee_1dab_8275_b13f_daf1cf478fc8 -->|method| 8125edb3_4d85_25a8_a3bb_0a422a5eed63
  3bc19f03_013c_4a61_000e_05bb38378ece["useIsValidIpv6()"]
  bc5894ee_1dab_8275_b13f_daf1cf478fc8 -->|method| 3bc19f03_013c_4a61_000e_05bb38378ece
  71545ce3_9f29_bc01_220c_6aaa1ad7d6b1["useIsValidIpv4()"]
  bc5894ee_1dab_8275_b13f_daf1cf478fc8 -->|method| 71545ce3_9f29_bc01_220c_6aaa1ad7d6b1

Relationship Graph

Source Code

microbench/src/main/java/io/netty/microbenchmark/common/NetUtilBenchmark.java lines 25–341

@Threads(4)
@Warmup(iterations = 10)
@Measurement(iterations = 10)
public class NetUtilBenchmark extends AbstractMicrobenchmark {

    @Benchmark
    public int useGetByNameIpv4() {
        int invalidCount = 0;
        for (String testEntry : invalidIpV4Hosts) {
            if (NetUtil.getByName(testEntry) == null) {
                ++invalidCount;
            }
        }
        return invalidCount;
    }

    @Benchmark
    public int useGetByNameIpv6() {
        int invalidCount = 0;
        for (String testEntry : invalidIpV6Hosts) {
            if (NetUtil.getByName(testEntry) == null) {
                ++invalidCount;
            }
        }
        return invalidCount;
    }

    @Benchmark
    public int useIsValidIpv6() {
        int invalidCount = 0;
        for (String host : invalidIpV6Hosts) {
            if (!NetUtil.isValidIpV6Address(host)) {
                ++invalidCount;
            }
        }
        return invalidCount;
    }

    @Benchmark
    public int useIsValidIpv4() {
        int invalidCount = 0;
        for (String host : invalidIpV4Hosts) {
            if (!NetUtil.isValidIpV4Address(host)) {
                ++invalidCount;
            }
        }
        return invalidCount;
    }

    private static final String[] invalidIpV4Hosts = {
        "1.256.3.4",
        "256.0.0.1",
        "1.1.1.1.1",
        "x.255.255.255",
        "0.1:0.0",
        "0.1.0.0:",
        "127.0.0.",
        "1.2..4",
        "192.0.1",
        "192.0.1.1.1",
        "192.0.1.a",
        "19a.0.1.1",
        "a.0.1.1",
        ".0.1.1",
        "127.0.0",
        "192.0.1.256",
        "0.0.200.259",
        "1.1.-1.1",
        "1.1. 1.1",
        "1.1.1.1 ",
        "1.1.+1.1",
        "0.0x1.0.255",
        "0.01x.0.255",
        "0.x01.0.255",
        "0.-.0.0",
        "0..0.0",
        "0.A.0.0",
        "0.1111.0.0",
        "..."
    };

Frequently Asked Questions

What is the NetUtilBenchmark class?
NetUtilBenchmark is a class in the netty codebase, defined in microbench/src/main/java/io/netty/microbenchmark/common/NetUtilBenchmark.java.
Where is NetUtilBenchmark defined?
NetUtilBenchmark is defined in microbench/src/main/java/io/netty/microbenchmark/common/NetUtilBenchmark.java at line 25.

Analyze Your Own Codebase

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

Try Supermodel Free