You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by xu...@apache.org on 2024/04/11 12:06:16 UTC
(opendal) branch benchmark updated: Try
This is an automated email from the ASF dual-hosted git repository.
xuanwo pushed a commit to branch benchmark
in repository https://gitbox.apache.org/repos/asf/opendal.git
The following commit(s) were added to refs/heads/benchmark by this push:
new 5ca8c53c3c Try
5ca8c53c3c is described below
commit 5ca8c53c3cd4505dd3541bb94cfb1ca672bdc126
Author: Xuanwo <gi...@xuanwo.io>
AuthorDate: Thu Apr 11 20:06:06 2024 +0800
Try
Signed-off-by: Xuanwo <gi...@xuanwo.io>
---
core/benches/ops/read.rs | 9 +++------
core/src/types/reader.rs | 4 ++++
2 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/core/benches/ops/read.rs b/core/benches/ops/read.rs
index 5bca410a6a..6df1f9f587 100644
--- a/core/benches/ops/read.rs
+++ b/core/benches/ops/read.rs
@@ -16,6 +16,7 @@
// under the License.
use criterion::Criterion;
+use futures::io;
use opendal::raw::tests::init_test_service;
use opendal::raw::tests::TEST_RUNTIME;
use opendal::Operator;
@@ -51,12 +52,8 @@ fn bench_read_full(c: &mut Criterion, name: &str, op: Operator) {
b.to_async(&*TEST_RUNTIME).iter(|| async {
let r = op.reader_with(path).await.unwrap();
- let _ = r
- .read(0..size.bytes() as u64)
- .await
- .expect("read must succeed");
- // let r = r.into_futures_io_async_read(0..size.bytes() as u64);
- // io::copy(r, &mut io::sink()).await.unwrap();
+ let r = r.into_futures_io_async_read(0..size.bytes() as u64);
+ io::copy(r, &mut io::sink()).await.unwrap();
})
});
diff --git a/core/src/types/reader.rs b/core/src/types/reader.rs
index 3ff7cb7588..95a75e58b9 100644
--- a/core/src/types/reader.rs
+++ b/core/src/types/reader.rs
@@ -271,6 +271,10 @@ pub mod into_futures_async_read {
fn consume(mut self: Pin<&mut Self>, amt: usize) {
self.buf.advance(amt);
+ // Make sure buf has been dropped before starting new request.
+ // if self.buf.is_empty() {
+ // self.buf = Buffer::new();
+ // }
self.cur += amt as u64;
}
}