Skip to content

Commit

Permalink
Add multi-threading and fix some minor performance issues
Browse files Browse the repository at this point in the history
  • Loading branch information
allada committed Jan 3, 2021
1 parent e61482a commit 0ed309c
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Expand Up @@ -16,7 +16,7 @@ async-trait = "0.1.42"
fixed-buffer = "0.2.2"
futures = "0.3.8"
# We must use tokio 0.2.x because tonic runtime uses it.
tokio = { version = "0.2", features = ["macros"] }
tokio = { version = "0.2", features = ["macros", "io-util", "rt-threaded"] }
tonic = "0.3.1"
lazy-init = "0.4.0"
log = "0.4.11"
Expand Down
2 changes: 1 addition & 1 deletion cas/store/memory_store.rs
Expand Up @@ -38,7 +38,7 @@ impl StoreTrait for MemoryStore {
digest: &'a DigestInfo,
mut reader: Box<dyn AsyncRead + Send + Unpin + 'b>,
) -> Result<(), Error> {
let mut buffer = Vec::new();
let mut buffer = Vec::with_capacity(digest.size_bytes as usize);
let read_size = reader.read_to_end(&mut buffer).await? as i64;
error_if!(
self.verify_size && read_size != digest.size_bytes,
Expand Down
3 changes: 3 additions & 0 deletions third_party/remote/BUILD.tokio-0.2.24.bazel
Expand Up @@ -47,7 +47,9 @@ rust_library(
"macros",
"memchr",
"mio",
"num_cpus",
"rt-core",
"rt-threaded",
"slab",
"stream",
"sync",
Expand Down Expand Up @@ -79,6 +81,7 @@ rust_library(
"@raze__lazy_static__1_4_0//:lazy_static",
"@raze__memchr__2_3_4//:memchr",
"@raze__mio__0_6_23//:mio",
"@raze__num_cpus__1_13_0//:num_cpus",
"@raze__pin_project_lite__0_1_11//:pin_project_lite",
"@raze__slab__0_4_2//:slab",
] + selects.with_or({
Expand Down
1 change: 0 additions & 1 deletion util/async_fixed_buffer.rs
Expand Up @@ -25,7 +25,6 @@ use fixed_buffer::FixedBuf;

use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering};

// #[derive(Pin)]
pub struct AsyncFixedBuf<T> {
inner: FixedBuf<T>,
waker: Mutex<Option<Waker>>,
Expand Down

0 comments on commit 0ed309c

Please sign in to comment.