From 569287b15b6482a39f2c816f103574c3b35351f8 Mon Sep 17 00:00:00 2001 From: Marcos Casagrande Date: Tue, 4 Oct 2022 15:48:50 +0200 Subject: perf(ext/fetch): consume body using ops (#16038) This commit adds a fast path to `Request` and `Response` that make consuming request bodies much faster when using `Body#text`, `Body#arrayBuffer`, and `Body#blob`, if the body is a FastStream. Because the response bodies for `fetch` are FastStream, this speeds up consuming `fetch` response bodies significantly. --- core/resources.rs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'core/resources.rs') diff --git a/core/resources.rs b/core/resources.rs index 56c9298af..1a1ba3193 100644 --- a/core/resources.rs +++ b/core/resources.rs @@ -64,6 +64,10 @@ pub trait Resource: Any + 'static { fn backing_fd(self: Rc) -> Option { None } + + fn size_hint(&self) -> (u64, Option) { + (0, None) + } } impl dyn Resource { -- cgit v1.2.3