summaryrefslogtreecommitdiff
path: root/core/resources.rs
diff options
context:
space:
mode:
authorMarcos Casagrande <marcoscvp90@gmail.com>2022-10-04 15:48:50 +0200
committerGitHub <noreply@github.com>2022-10-04 15:48:50 +0200
commit569287b15b6482a39f2c816f103574c3b35351f8 (patch)
treeff8433fc87613e3016ff7a188ee34aa3fc7d81c4 /core/resources.rs
parent0b4a6c4d084df54e827bc7767ce8653e06c45e93 (diff)
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.
Diffstat (limited to 'core/resources.rs')
-rw-r--r--core/resources.rs4
1 files changed, 4 insertions, 0 deletions
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<Self>) -> Option<std::os::unix::prelude::RawFd> {
None
}
+
+ fn size_hint(&self) -> (u64, Option<u64>) {
+ (0, None)
+ }
}
impl dyn Resource {