MatrixAI / js-quic

QUIC Networking for TypeScript & JavaScript
https://matrixai.github.io/js-quic/
Apache License 2.0
13 stars 1 forks source link

Exclude low level events from re-dispatch #64

Closed tegefaulkes closed 8 months ago

tegefaulkes commented 11 months ago

Specification

Events such as the EventQuicStreamSend and EventQuicConnectionSend and any other very low level events needs to be excluded from re-dispatch.

Currently events bubble upwards through re-dispatching at every level . A QUICStream event will be created in QUICStream and then cloned and dispatched in the QUICConnection, QuicClient, QuicServer, and in Polykey through the NodeConnection and NodeConnectionManager. As a result a QUICStream event can be cloned 4-ish times. This will be a severe performance hit for send events which are dispatched for every packet.

To solve this, we need to special case and exclude these events from re-dispatch inside the QUICConnection for the EventQuicStreamSend and inside the QUICSocket for the EventQUICConnectionSend event.

Additional context

Tasks

  1. Exclude all send events from being re-dispatched further than they're needed.
  2. Review and do the same for any event that happens often through normal usage. 'Once' events can be ignored here.
CMCDragonkai commented 10 months ago

@amydevs this is a performance issue. You want to be aware of this when listening for events, or when you are dispatching events.

tegefaulkes commented 8 months ago

This has been addressed by commit 82e4a433ebb5d2af94cefcaf0d0a348873189100.

CMCDragonkai commented 8 months ago

All of the above event names should be QUIC not Quic, I think they were typos.

CMCDragonkai commented 8 months ago

In summary:

This is not a choice that can be done in js-events, this is context dependent on the user.

The same choices occur with observable reactive properties later.