Debian Codegraph @

R/capableOfProfmem.R

raw
1 # A lookup-only-once version of capabilities("profmem")
2 # Benchmarking shows it's 8-10 times faster this way.
3 capableOfProfmem <- local({
4 res <- NA
5 function() {
6 if (is.na(res)) {
7 res <<- capabilities("profmem")
8 }
9 res
10 }
11 })