tquic icon indicating copy to clipboard operation
tquic copied to clipboard

Remove direct `Instant::now()` calls

Open birneee opened this issue 1 year ago • 1 comments

Tquic currently calls Instant::now() in various places, e.g. connection.rs or endpoint.rs. Moving time management from tquic to the applications would make the state machine more deterministic, which would improve testability and performance. Also, the time granularity could be controlled by the application.

Automated tests that require timed events would be simpler.

In my sender performance profiling, currently about 2% of the recorded samples are now() calls, this could be reduced.

For example the signature of send(&mut self, out: &mut [u8]) could be changed to send(&mut self, out: &mut [u8], now: Instant).

Related issue: https://github.com/cloudflare/quiche/issues/1828

birneee avatar Dec 16 '24 09:12 birneee

Great idea! And we will consider supporting it in the future. Thank you very much.

xiaofei0800 avatar Feb 11 '25 01:02 xiaofei0800