Optimize netty epoll packet sending
TeaCon now uses Arclight, so we have a chance to experience heavy loads. Per TeaCon profiling results packet sending uses a native call to wakeup threads which can take up to 20% tick time. This should work fine as server will do a flush per tick.
This commit is contained in:
parent
91af85d335
commit
8df52d958d
|
@ -0,0 +1,18 @@
|
||||||
|
package io.izzel.arclight.common.mixin.optimization.general;
|
||||||
|
|
||||||
|
import io.netty.util.concurrent.AbstractEventExecutor;
|
||||||
|
import net.minecraft.network.Connection;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.ModifyArg;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Slice;
|
||||||
|
|
||||||
|
@Mixin(Connection.class)
|
||||||
|
public class ConnectionMixin_Optimize {
|
||||||
|
|
||||||
|
@ModifyArg(method = "sendPacket", at = @At(value = "INVOKE", remap = false, target = "Lio/netty/channel/EventLoop;execute(Ljava/lang/Runnable;)V"),
|
||||||
|
slice = @Slice(from = @At(value = "INVOKE", remap = false, target = "Lio/netty/channel/EventLoop;inEventLoop()Z")))
|
||||||
|
private Runnable arclight$useLazyRunnable(Runnable runnable) {
|
||||||
|
return (AbstractEventExecutor.LazyRunnable) runnable::run;
|
||||||
|
}
|
||||||
|
}
|
|
@ -6,6 +6,7 @@
|
||||||
"compatibilityLevel": "JAVA_11",
|
"compatibilityLevel": "JAVA_11",
|
||||||
"mixins": [
|
"mixins": [
|
||||||
"ClassInheritanceMultiMapMixin",
|
"ClassInheritanceMultiMapMixin",
|
||||||
|
"ConnectionMixin_Optimize",
|
||||||
"EntityDataManagerMixin_Optimize",
|
"EntityDataManagerMixin_Optimize",
|
||||||
"GoalMixin",
|
"GoalMixin",
|
||||||
"MobMixin_Optimization",
|
"MobMixin_Optimization",
|
||||||
|
|
Loading…
Reference in New Issue
Block a user