fix(core): Adds SkipLocalsInitAttribute support, optimizes broadcasted packets (#363)
- [X] Adds support for `SkipLocalsInitAttribute`. SkipLocalsInitAttribute skips initializing stack variables including `stackalloc`. I don't think it is wired/working yet but should be implemented soon. - [X] Optimizes broadcasted packets by checking if the first byte (packet ID) is non-zero. If it is already set, it reuses the buffer. - [X] Removes unnecessary refs to Spans. I don't think the Span struct itself is mutable, so a ref is not helpful.
This commit is contained in:
parent
9c9591b098
commit
03d0a4664e
25 changed files with 478 additions and 285 deletions
|
|
@ -50,7 +50,7 @@ namespace Server.Tests.Network
|
|||
|
||||
Span<byte> actual = stackalloc byte[OutgoingEffectPackets.ParticleEffectLength];
|
||||
OutgoingEffectPackets.CreateParticleEffect(
|
||||
ref actual,
|
||||
actual,
|
||||
effectType, from, to, itemId, fromPoint, toPoint, speed, duration, direction,
|
||||
explode, hue, renderMode, effect, explodeEffect, explodeSound, serial, layer,
|
||||
unknown
|
||||
|
|
@ -82,7 +82,7 @@ namespace Server.Tests.Network
|
|||
|
||||
Span<byte> actual = stackalloc byte[OutgoingEffectPackets.HuedEffectLength];
|
||||
OutgoingEffectPackets.CreateHuedEffect(
|
||||
ref actual,
|
||||
actual,
|
||||
effectType, from, to, itemId, fromPoint, toPoint, speed,
|
||||
duration, direction, explode, hue, renderMode
|
||||
);
|
||||
|
|
@ -110,10 +110,7 @@ namespace Server.Tests.Network
|
|||
var expected = new BoltEffect(entity, hue).Compile();
|
||||
|
||||
Span<byte> actual = stackalloc byte[OutgoingEffectPackets.BoltEffectLength];
|
||||
OutgoingEffectPackets.CreateBoltEffect(
|
||||
ref actual,
|
||||
entity, hue
|
||||
);
|
||||
OutgoingEffectPackets.CreateBoltEffect(actual, entity, hue);
|
||||
|
||||
AssertThat.Equal(actual, expected);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue