Closed VelvetToroyashi closed 9 months ago
The preliminary benchmarks showed 83% improvement in allocation, and marginal gains in terms of speed. The method implemented is the one labeled as MaxineRecommendation
; which uses a manually-allocated Utf8JsonReader
.
Method | Mean | Error | StdDev | Baseline | Gen0 | Allocated |
---|---|---|---|---|---|---|
Remora | 3.053 us | 0.0213 us | 0.0166 us | No | 0.1068 | 920 B |
Velvet | 2.820 us | 0.0125 us | 0.0117 us | No | 0.0725 | 608 B |
MaxineRecommendation | 2.721 us | 0.0367 us | 0.0326 us | No | 0.0191 | 160 B |
Discord keeps closing the socket due to "invalid payload data", though this payload appears to be correct.
{"op":2,"s":null,"t":null,"d":{"token":"<token>","properties":{"os":"windows","browser":"Remora.Discord","device":"Remora.Discord"},"compress":false,"large_threshold":50,"intents":33281}}
EDIT: OK, upon further investigation, .GetMemory()
appears to be returning entirely invalid data. I'll fix this momentarily.
Appears to work now, cc @Nihlus
This PR adds even further optimizations to receiving and particularly sending payloads.
This is in addition to #300.