Skip to content

Commit

Permalink
shave off slight overhead
Browse files Browse the repository at this point in the history
  • Loading branch information
wlandau committed Jan 2, 2025
1 parent 12ec6ea commit fb11ba1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion R/class_junction.R
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ junction_extract_index <- function(junction, name) {

junction_extract_deps <- function(junction, index) {
if (.subset2(junction, "has_deps")) {
as.character(vctrs::vec_slice(x = .subset2(junction, "deps"), i = index))
deps <- .subset2(junction, "deps")
slice <- vctrs::vec_slice(x = deps, i = index)
unlist(as.list(slice), use.names = FALSE)
} else {
character(0L)
}
Expand Down
3 changes: 2 additions & 1 deletion R/class_pattern.R
Original file line number Diff line number Diff line change
Expand Up @@ -267,11 +267,12 @@ pattern_prepend_branches <- function(target, scheduler) {
pattern_produce_branch <- function(target, name) {
junction <- .subset2(target, "junction")
index <- junction_extract_index(junction, name)
deps_child <- junction_extract_deps(junction, index)
branch_init(
name = name,
command = .subset2(target, "command"),
deps_parent = .subset2(target, "deps"),
deps_child = junction_extract_deps(junction, index),
deps_child = deps_child,
settings = .subset2(target, "settings"),
cue = .subset2(target, "cue"),
store = .subset2(target, "store"),
Expand Down

0 comments on commit fb11ba1

Please sign in to comment.