-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: only use cache when required #182
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #182 +/- ##
==========================================
+ Coverage 86.57% 87.18% +0.60%
==========================================
Files 56 56
Lines 2838 2824 -14
==========================================
+ Hits 2457 2462 +5
+ Misses 381 362 -19
☔ View full report in Codecov by Sentry. |
crates/tarball/src/lib.rs
Outdated
pub async fn run(self) -> Result<Arc<HashMap<OsString, PathBuf>>, TarballError> { | ||
let &DownloadTarballToStore { tarball_cache, package_url, .. } = &self; | ||
/// Execute the subroutine with cache. | ||
pub async fn with_cache( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit:
pub async fn with_cache( | |
pub async fn run_with_cache( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, a function should be a verb.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a function should be a verb
BTW, Rust naming convention isn't like that.
crates/tarball/src/lib.rs
Outdated
let mut cache_write = cache_lock.write().await; | ||
*cache_write = CacheValue::Available(Arc::clone(&cas_paths)); | ||
notify.notify_waiters(); | ||
Ok(cas_paths) | ||
} | ||
} | ||
|
||
async fn without_cache(&self) -> Result<Arc<HashMap<OsString, PathBuf>>, TarballError> { | ||
/// Execute the subroutine without a cache. | ||
pub async fn without_cache(&self) -> Result<HashMap<OsString, PathBuf>, TarballError> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit
pub async fn without_cache(&self) -> Result<HashMap<OsString, PathBuf>, TarballError> { | |
pub async fn run_without_cache(&self) -> Result<HashMap<OsString, PathBuf>, TarballError> { |
Micro-Benchmark ResultsLinux
|
Integrated-Benchmark Report (Linux)Scenario: Frozen Lockfile
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.18240761053666665,
"stddev": 0.01702043888876676,
"median": 0.17859883412,
"user": 0.06913839000000001,
"system": 0.10850109333333331,
"min": 0.15587933012000002,
"max": 0.20538548912000001,
"times": [
0.20538548912000001,
0.17431539112000002,
0.17490033312,
0.20422093812,
0.18229733512000001,
0.15587933012000002,
0.17337883312000002,
0.19621883712000002,
0.16110273112,
0.18639313612000002,
0.17058653312000002,
0.20421243912
],
"exit_codes": [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"command": "pacquet@main",
"mean": 0.1764909955815385,
"stddev": 0.01421546437258257,
"median": 0.17504253412,
"user": 0.0702174476923077,
"system": 0.11147518307692308,
"min": 0.15345723012,
"max": 0.20062133812000002,
"times": [
0.17920653512,
0.16898733212,
0.17504253412,
0.16804723212,
0.18521073512000003,
0.15541803012000002,
0.18387913512,
0.17286573312,
0.19159913712,
0.16710113312000002,
0.20062133812000002,
0.15345723012,
0.19294683712000002
],
"exit_codes": [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
}
]
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is it called a tarball cache at all? I had to look into the code because I thought it was about a filesystem cache for tarballs. I'd say it is a tarball_locker. And the function would be run_with_lock
and run_without_lock
.
crates/tarball/src/lib.rs
Outdated
pub async fn run(self) -> Result<Arc<HashMap<OsString, PathBuf>>, TarballError> { | ||
let &DownloadTarballToStore { tarball_cache, package_url, .. } = &self; | ||
/// Execute the subroutine with cache. | ||
pub async fn with_cache( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, a function should be a verb.
@zkochan |
No description provided.