Waterfall/BungeeCord-Patches/0009-Presize-the-HTTP-response-buffer.patch
Shane Freeder 1c8ea44393
move up Fixup ProtocolConstants to waterfall
This patch contains a trivial formatting fix, while while somewhat
pointless, I decided to keep, the main advantage is in the util
helpers which will aim to keep code cleaner (I've wished for this
to be included in waterfall for a while, and given future work, I
feel now is a good time to shift it over)
2018-10-27 22:18:13 +01:00

24 lines
1.0 KiB
Diff

From 2ccf865f350de60caee4370d653329f31b75cd1a Mon Sep 17 00:00:00 2001
From: Tux <write@imaginarycode.com>
Date: Wed, 13 Apr 2016 15:17:05 -0400
Subject: [PATCH] Presize the HTTP response buffer
16 characters is extremely small, and all responses start around 256 bytes. 640 characters seems to be good (covering skins and capes), based on sampling profile API responses.
diff --git a/proxy/src/main/java/net/md_5/bungee/http/HttpHandler.java b/proxy/src/main/java/net/md_5/bungee/http/HttpHandler.java
index 96d0a71d..bac6b1b0 100644
--- a/proxy/src/main/java/net/md_5/bungee/http/HttpHandler.java
+++ b/proxy/src/main/java/net/md_5/bungee/http/HttpHandler.java
@@ -16,7 +16,7 @@ public class HttpHandler extends SimpleChannelInboundHandler<HttpObject>
{
private final Callback<String> callback;
- private final StringBuilder buffer = new StringBuilder();
+ private final StringBuilder buffer = new StringBuilder(640);
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception
--
2.19.1