Skip to content

Commit

Permalink
simulate reset
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzwalthert committed Oct 22, 2020
1 parent 88e8d7a commit 7f360f1
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions bench/02-basic.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,12 @@ with_cache <- marker(
# style guide (some but not all expressions are)
with_cache <- marker(
cache_recording = {
gert::git_reset_hard(repo = path)
cat(
bench::system_time(gert::git_reset_hard(repo = path))[["process"]],
sep = "\n",
file = "timing-reset",
append = TRUE
)
style_pkg(path, filetype = c("R", "rmd"))
}
)
Expand All @@ -41,9 +46,19 @@ cache_info()
# recording and applying, transformers always ran on all expressions.
gert::git_reset_hard(repo = path)
cache_deactivate()

time_for_git_reset <- as.numeric(readLines("timing-reset"))
cat(
"Waiting ",
round(mean(time_for_git_reset), 3),
" seconds on average to simulate git reset. That way, `without_cache` and ",
"`cache_recording` are comparable. The 95% interval for reset are (",
round(quantile(time_for_git_reset, 0.025), 3), ", ",
round(quantile(time_for_git_reset, 0.975), 3), ").",
sep = ""
)
without_cache <- marker(
without_cache = {
Sys.sleep(mean(time_for_git_reset))
style_pkg(path, filetype = c("R", "rmd"))
}
)
Expand Down

0 comments on commit 7f360f1

Please sign in to comment.