Skip to content

Commit

Permalink
Require parallelly (>= 1.38.0) so we can use parallelly::serializedSi…
Browse files Browse the repository at this point in the history
…ze() [#736]
  • Loading branch information
HenrikBengtsson committed Jul 28, 2024
1 parent 2f50f72 commit af7055d
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 9 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
Package: future
Version: 1.33.2-9009
Version: 1.33.2-9010
Title: Unified Parallel and Distributed Processing in R for Everyone
Imports:
digest,
globals (>= 0.16.1),
listenv (>= 0.8.0),
parallel,
parallelly (>= 1.34.0),
parallelly (>= 1.38.0),
utils
Suggests:
methods,
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ importFrom(parallelly,isNodeAlive)
importFrom(parallelly,makeClusterMPI)
importFrom(parallelly,makeClusterPSOCK)
importFrom(parallelly,makeNodePSOCK)
importFrom(parallelly,serializedSize)
importFrom(parallelly,supportsMulticore)
importFrom(utils,capture.output)
importFrom(utils,file_test)
Expand Down
3 changes: 1 addition & 2 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
## Performance

* Size calculation of globals is now done using the much faster
`parallelly::serializedSize()`, if **parallelly** (>= 1.38.0) is
installed.
`parallelly::serializedSize()`.

## Bug Fixes

Expand Down
6 changes: 1 addition & 5 deletions R/utils-objectSize.R
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
## A *rough* estimate of size of an object + its environment.
#' @keywords internal
#' @importFrom utils object.size
#' @importFrom parallelly serializedSize
objectSize <- function(x, depth = 3L, enclosure = getOption("future.globals.objectSize.enclosure", FALSE)) {
# Nothing to do?
if (isNamespace(x)) return(0)
if (depth <= 0) return(0)

method <- getOption("future.globals.objectSize.method", "objectSize")
if (method == "serializedSize") {
ns <- getNamespace("parallelly")
if (!exists("serializedSize", envir = ns, inherits = FALSE)) {
stop("Option 'future.globals.objectSize.method' supports \"serializedSize\" only for parallelly (>= 1.38.0)")
}
serializedSize <- get("serializedSize", envir = ns, inherits = FALSE)
size <- serializedSize(x)
return(size)
} else if (method != "objectSize") {
Expand Down

0 comments on commit af7055d

Please sign in to comment.