Waterfall/BungeeCord-Patches/0007-Presize-the-HTTP-response-buffer.patch
Techcable 3809083007
Turn waterfall into a patch-based fork like Spigot and Paper (WIP)
Allows us to easily see and manage the diff with upstream.
Makes fixing conflicts with upstream easier and shows a cleaner, more acurate commit history.

All credits to scripts go to @md_5 @aikar @Zbob750 @Thinkofname @Byteflux @Techcable (GPL3 Licensed)
2016-05-30 14:51:51 -06:00

24 lines
1.0 KiB
Diff

From 413435b7f36587ca4cc562d1ffc373fa24b6296d 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 96d0a71..bac6b1b 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.8.3