Skip to content

Commit

Permalink
Add internal jit_cache()
Browse files Browse the repository at this point in the history
  • Loading branch information
lionel- committed Dec 3, 2021
1 parent d75357c commit 803d1f1
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions R/snapshot.R
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,28 @@ root_precious_list <- function() {
the$precious_list()
}

jit_cache_source <- "
#define R_NO_REMAP
#include <Rinternals.h>
extern SEXP JIT_cache;
[[cpp11::register]]
SEXP jit_cache() {
return JIT_cache;
}
"
jit_cache <- function() {
check_installed(c("cpp11", "decor"))

if (is_null(the$jit_cache)) {
cpp11::cpp_source(code = jit_cache_source)
the$jit_cache <- jit_cache
}

the$jit_cache()
}

#' Find all shortest or simple paths
#'
#' Wrappers around [igraph::all_shortest_paths()] and
Expand Down

0 comments on commit 803d1f1

Please sign in to comment.