Home / Function/ init() — netty Function Reference

init() — netty Function Reference

Architecture documentation for the init() function in Http2PseudoHeadersLookupBenchmark.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  73539fe4_5f80_0052_8f36_a55371f1a1e6["init()"]
  098bd603_5fdc_d6b3_c285_95fcd39a73b6["Http2PseudoHeadersLookupBenchmark"]
  73539fe4_5f80_0052_8f36_a55371f1a1e6 -->|defined in| 098bd603_5fdc_d6b3_c285_95fcd39a73b6
  style 73539fe4_5f80_0052_8f36_a55371f1a1e6 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

microbench/src/main/java/io/netty/handler/codec/http2/Http2PseudoHeadersLookupBenchmark.java lines 51–72

    @Setup
    public void init() {
        // this benchmark is assuming a good happy path:
        // 1. ascii strings have hashCode cached
        // 2. String doesn't have AsciiString::hashCode cached -> cannot be compared directly with AsciiStrings!
        // 3. the call-sites are never observing the 2 types together
        PseudoHeaderName[] pseudoHeaderNames = PseudoHeaderName.values();
        asciiStrings = new AsciiString[pseudoHeaderNames.length];
        strings = new String[pseudoHeaderNames.length];
        for (int i = 0; i < pseudoHeaderNames.length; i++) {
            PseudoHeaderName pseudoHeaderName = pseudoHeaderNames[i];
            asciiStrings[i] = same? pseudoHeaderName.value() : new AsciiString(pseudoHeaderName.value().array(), true);
            byte[] chars = asciiStrings[i].array();
            strings[i] = same? pseudoHeaderName.value().toString() : new String(chars, 0, 0, chars.length);
            // force hashCode caching
            asciiStrings[i].hashCode();
            pseudoHeaderName.hashCode();
            pseudoHeaderName.toString().hashCode();
            strings[i].hashCode();
        }
        this.headers = new DefaultHttp2Headers();
    }

Domain

Subdomains

Frequently Asked Questions

What does init() do?
init() is a function in the netty codebase, defined in microbench/src/main/java/io/netty/handler/codec/http2/Http2PseudoHeadersLookupBenchmark.java.
Where is init() defined?
init() is defined in microbench/src/main/java/io/netty/handler/codec/http2/Http2PseudoHeadersLookupBenchmark.java at line 51.

Analyze Your Own Codebase

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

Try Supermodel Free