From 32a82239f2f283e603310341c5aaf8f1cf4d61af Mon Sep 17 00:00:00 2001 From: philchalmers Date: Wed, 24 Jul 2024 11:47:24 -0400 Subject: [PATCH] identical is faster --- NEWS.md | 4 +++- R/SimCollect.R | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/NEWS.md b/NEWS.md index d5e96ddc..9e38beb5 100644 --- a/NEWS.md +++ b/NEWS.md @@ -4,7 +4,9 @@ - Better name checking when using the supported `list` inputs in `runSimulation()` and `runArraySimulation()` - + +- `SimCollect()` more efficient when combining a large number of files (e.g., + greater than 5000 `.rds` files stored via `runArraySimulation()`) ## Changes in SimDesign 2.16 diff --git a/R/SimCollect.R b/R/SimCollect.R index bcaf75f5..4ca5064e 100644 --- a/R/SimCollect.R +++ b/R/SimCollect.R @@ -243,7 +243,7 @@ SimCollect <- function(files = NULL, filename = NULL, if(i %in% print_when) cat(".") left <- setdiff(1L:length(designs), identical_set) pick_design <- designs[[min(left)]] - matched <- which(sapply(designs, \(x) all(x == pick_design))) + matched <- which(sapply(designs, \(x) identical(x, pick_design))) set.index[matched] <- rep(set.count, length(matched)) set.count <- set.count + 1L identical_set <- c(identical_set, matched)