|
|
|
@ -74,8 +74,8 @@ public class HeadersAdapterBenchmark { |
|
|
|
public MultiValueMap<String, String> headers; |
|
|
|
public MultiValueMap<String, String> headers; |
|
|
|
public Function<MultiValueMap<String, String>, Set<Map.Entry<String, List<String>>>> entriesProvider; |
|
|
|
public Function<MultiValueMap<String, String>, Set<Map.Entry<String, List<String>>>> entriesProvider; |
|
|
|
|
|
|
|
|
|
|
|
//Uncomment the following line and comment the similar line for setupImplementationBaseline below
|
|
|
|
// Uncomment the following line and comment the similar line for setupImplementationBaseline below
|
|
|
|
//to benchmark current implementations
|
|
|
|
// to benchmark current implementations
|
|
|
|
@Setup(Level.Trial) |
|
|
|
@Setup(Level.Trial) |
|
|
|
public void initImplementationNew() { |
|
|
|
public void initImplementationNew() { |
|
|
|
this.entriesProvider = map -> new HttpHeaders(map).headerSet(); |
|
|
|
this.entriesProvider = map -> new HttpHeaders(map).headerSet(); |
|
|
|
@ -85,7 +85,7 @@ public class HeadersAdapterBenchmark { |
|
|
|
case "HttpComponents" -> new HttpComponentsHeadersAdapter(new HttpGet("https://example.com")); |
|
|
|
case "HttpComponents" -> new HttpComponentsHeadersAdapter(new HttpGet("https://example.com")); |
|
|
|
case "Netty5" -> new Netty5HeadersAdapter(io.netty5.handler.codec.http.headers.HttpHeaders.newHeaders()); |
|
|
|
case "Netty5" -> new Netty5HeadersAdapter(io.netty5.handler.codec.http.headers.HttpHeaders.newHeaders()); |
|
|
|
case "Jetty" -> new JettyHeadersAdapter(HttpFields.build()); |
|
|
|
case "Jetty" -> new JettyHeadersAdapter(HttpFields.build()); |
|
|
|
//FIXME tomcat/undertow implementations (in another package)
|
|
|
|
// FIXME tomcat/undertow implementations (in another package)
|
|
|
|
// case "Tomcat" -> new TomcatHeadersAdapter(new MimeHeaders());
|
|
|
|
// case "Tomcat" -> new TomcatHeadersAdapter(new MimeHeaders());
|
|
|
|
// case "Undertow" -> new UndertowHeadersAdapter(new HeaderMap());
|
|
|
|
// case "Undertow" -> new UndertowHeadersAdapter(new HeaderMap());
|
|
|
|
default -> throw new IllegalArgumentException("Unsupported implementation: " + this.implementation); |
|
|
|
default -> throw new IllegalArgumentException("Unsupported implementation: " + this.implementation); |
|
|
|
@ -93,8 +93,8 @@ public class HeadersAdapterBenchmark { |
|
|
|
initHeaders(); |
|
|
|
initHeaders(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//Uncomment the following line and comment the similar line for setupImplementationNew above
|
|
|
|
// Uncomment the following line and comment the similar line for setupImplementationNew above
|
|
|
|
//to benchmark old implementations
|
|
|
|
// to benchmark old implementations
|
|
|
|
// @Setup(Level.Trial)
|
|
|
|
// @Setup(Level.Trial)
|
|
|
|
public void setupImplementationBaseline() { |
|
|
|
public void setupImplementationBaseline() { |
|
|
|
this.entriesProvider = MultiValueMap::entrySet; |
|
|
|
this.entriesProvider = MultiValueMap::entrySet; |
|
|
|
|