HttpMethodMapBenchmark.java — netty Source File
Architecture documentation for HttpMethodMapBenchmark.java, a java file in the netty codebase.
Entity Profile
Relationship Graph
Source Code
/*
* Copyright 2019 The Netty Project
*
* The Netty Project licenses this file to you under the Apache License,
* version 2.0 (the "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at:
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.netty.handler.codec.http;
import io.netty.microbench.util.AbstractMicrobenchmark;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Measurement;
import org.openjdk.jmh.annotations.OutputTimeUnit;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.annotations.Warmup;
import org.openjdk.jmh.infra.Blackhole;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import static io.netty.handler.codec.http.HttpMethod.CONNECT;
import static io.netty.handler.codec.http.HttpMethod.DELETE;
import static io.netty.handler.codec.http.HttpMethod.GET;
import static io.netty.handler.codec.http.HttpMethod.HEAD;
import static io.netty.handler.codec.http.HttpMethod.OPTIONS;
import static io.netty.handler.codec.http.HttpMethod.PATCH;
import static io.netty.handler.codec.http.HttpMethod.POST;
import static io.netty.handler.codec.http.HttpMethod.PUT;
import static io.netty.handler.codec.http.HttpMethod.TRACE;
import static io.netty.util.internal.MathUtil.findNextPositivePowerOfTwo;
@State(Scope.Benchmark)
@Warmup(iterations = 5)
@Measurement(iterations = 8)
@OutputTimeUnit(TimeUnit.MICROSECONDS)
public class HttpMethodMapBenchmark extends AbstractMicrobenchmark {
private static final Map<String, HttpMethod> OLD_MAP = new HashMap<String, HttpMethod>();
private static final SimpleStringMap<HttpMethod> NEW_MAP;
private static final String[] KNOWN_METHODS;
private static final String[] MIXED_METHODS;
private static final String[] UNKNOWN_METHODS;
static {
// We intentionally don't use HttpMethod.toString() here to avoid the equals(..) comparison method from being
// able to short circuit due to reference equality checks and being biased toward the new approach. This
// simulates the behavior of HttpObjectDecoder which will build new String objects during the decode operation.
KNOWN_METHODS = new String[] {
"OPTIONS",
"GET",
"HEAD",
// ... (148 more lines)
Domain
Subdomains
Source
Frequently Asked Questions
What does HttpMethodMapBenchmark.java do?
HttpMethodMapBenchmark.java is a source file in the netty codebase, written in java. It belongs to the Buffer domain, Allocators subdomain.
Where is HttpMethodMapBenchmark.java in the architecture?
HttpMethodMapBenchmark.java is located at microbench/src/main/java/io/netty/handler/codec/http/HttpMethodMapBenchmark.java (domain: Buffer, subdomain: Allocators, directory: microbench/src/main/java/io/netty/handler/codec/http).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free