Skip to content

Commit

Permalink
memoized get_local_rows
Browse files Browse the repository at this point in the history
This *appears* correct. I tested it by inspection with the SUGG and CRAM data on a set seed in CV. I think I *could* set up a test for this, but it'd be a lot of work, a time-consuming test, and amount to repeatedly re-doing said test-by-inspection.

As it is, this memoization looks like it cuts the run time of CV down to a quarter of what it was.

refs: https://memoise.r-lib.org/reference/memoise.html#details
https://rdrr.io/r/base/ns-hooks.html
r-lib/profvis#134
r-lib/memoise#79 (comment)
  • Loading branch information
swpease committed Mar 18, 2024
1 parent f4bab28 commit 5677e8d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Imports:
dplyr,
lubridate,
magrittr,
memoise,
purrr,
rlang,
scoringRules,
Expand Down
3 changes: 3 additions & 0 deletions R/zzz.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.onLoad <- function(libname, pkgname) {
get_local_rows <<- memoise::memoise(get_local_rows, omit_args = c(".datetime"))
}

0 comments on commit 5677e8d

Please sign in to comment.