Performance changes
- Removed tons of delegate allocations
- Removed tons of closures
- Cached delegate creation where it would be created per operation (where it makes sense).
- Added state overloads to a bunch of hot paths to avoid closures.
Remove delegate allocations from ServerSentEventsTransport.
Rename Disposer to Subscription.
Added some delegate allocation optimizations to ForeverFrameTransport.
Added state overload to IMessageBus.Subscribe.
- Removed closure in Connection as a result
Don't allocate full cursors each time messages are received.
- Allocate an array of numbers to the next cursor id.
Don't allocate diffset just check for changes in groups.
Stop using StreamWriter and implement custom TextWriter.
- Write directly to the response if under 2K
- Write in 3K chunks if over 2K limit directly to the response.
Made changes to websocket handler.
- Only allocate 4K instead of 8K
- Don't allocate buffer up front
- Only pin empty buffers then read synchronously.
- Change all properties to fields in helper classes.
Fixed 0 byte buffer case in WebSocketMessageReader.
- Check if we're at the end of message in the reader.
- Cache common websocket message types.