From 03263ff5df887550fe51fcf9f67694ec151f052b Mon Sep 17 00:00:00 2001 From: Aikar Date: Sat, 21 Jan 2017 02:02:52 -0500 Subject: [PATCH] Remove the Vanilla Method Profiler Spigot rebrought this back after it was removed for years due to the performance hit. It is unknown if the JIT will optimize it out as effeciently with how it was added, so we do not want any risk of performance degredation. Paper has a proper Timings system that makes the Vanilla Method profiler obsolete and inferior. --- .../Remove-the-Vanilla-Method-Profiler.patch | 81 +++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 Spigot-Server-Patches/Remove-the-Vanilla-Method-Profiler.patch diff --git a/Spigot-Server-Patches/Remove-the-Vanilla-Method-Profiler.patch b/Spigot-Server-Patches/Remove-the-Vanilla-Method-Profiler.patch new file mode 100644 index 000000000..e63004d26 --- /dev/null +++ b/Spigot-Server-Patches/Remove-the-Vanilla-Method-Profiler.patch @@ -0,0 +1,81 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Sat, 21 Jan 2017 02:00:33 -0500 +Subject: [PATCH] Remove the Vanilla Method Profiler + +Spigot rebrought this back after it was removed for years due to the performance hit. + +It is unknown if the JIT will optimize it out as effeciently with how it was +added, so we do not want any risk of performance degredation. + +Paper has a proper Timings system that makes the Vanilla Method profiler obsolete and inferior. + +diff --git a/src/main/java/net/minecraft/server/CommandDebug.java b/src/main/java/net/minecraft/server/CommandDebug.java +index fe58d428f..938f62f83 100644 +--- a/src/main/java/net/minecraft/server/CommandDebug.java ++++ b/src/main/java/net/minecraft/server/CommandDebug.java +@@ -0,0 +0,0 @@ public class CommandDebug extends CommandAbstract { + + public void execute(MinecraftServer minecraftserver, ICommandListener icommandlistener, String[] astring) throws CommandException { + // CraftBukkit start - only allow use when enabled (so that no blank profile results occur) +- if (!minecraftserver.methodProfiler.ENABLED) { +- icommandlistener.sendMessage(new ChatComponentText("Vanilla debug profiling is disabled.")); +- icommandlistener.sendMessage(new ChatComponentText("To enable, restart the server with `-DenableDebugMethodProfiler=true' before `-jar'.")); +- icommandlistener.sendMessage(new ChatComponentText("Use `/timings' for plugin timings.")); ++ if (true) { // Paper ++ icommandlistener.sendMessage(new ChatComponentText("Use `/timings report'")); // Paper + return; + } ++ /* + // CraftBukkit end + if (astring.length < 1) { + throw new ExceptionUsage("commands.debug.usage", new Object[0]); +@@ -0,0 +0,0 @@ public class CommandDebug extends CommandAbstract { + return astring[(int) (System.nanoTime() % (long) astring.length)]; + } catch (Throwable throwable) { + return "Witty comment unavailable :("; +- } ++ }*/ // Paper + } + + public List tabComplete(MinecraftServer minecraftserver, ICommandListener icommandlistener, String[] astring, @Nullable BlockPosition blockposition) { +diff --git a/src/main/java/net/minecraft/server/MethodProfiler.java b/src/main/java/net/minecraft/server/MethodProfiler.java +index 654652916..276983485 100644 +--- a/src/main/java/net/minecraft/server/MethodProfiler.java ++++ b/src/main/java/net/minecraft/server/MethodProfiler.java +@@ -0,0 +0,0 @@ import java.util.List; + import java.util.Map; + import org.apache.logging.log4j.LogManager; + import org.apache.logging.log4j.Logger; +- +-public class MethodProfiler { ++// Paper - Remove this system - we have a more efficient Timings system ++/* ++class MethodProfiler { + + public static final boolean ENABLED = Boolean.getBoolean("enableDebugMethodProfiler"); // CraftBukkit - disable unless specified in JVM arguments + private static final Logger b = LogManager.getLogger(); +@@ -0,0 +0,0 @@ public class MethodProfiler { + } + } + } ++*/ ++ ++public class MethodProfiler { ++ public boolean a; ++ ++ MethodProfiler() {} ++ ++ public final void a() {} ++ ++ public final void a(String s) {} ++ ++ public final void b() {} ++ ++ public final void c(String s) {} ++ ++ public final String c() { ++ return null; ++ } ++} +-- \ No newline at end of file