Open HenrikBengtsson opened 6 years ago
I've updated globals::findGlobals()
to be much faster in these, most commonly used, cases(*). I've made sure it does not break any of the 29 reverse package dependencies (first and second generation). Install this new version as:
remotes::install_github("HenrikBengtsson/globals@develop")
(*) There will still be cases where this improvement won't help, e.g. long lists which in turn contains lists.
This is definitely helpful. I was just doing some testing iterating over rsample
cross-validation objects (lists containing data frames and other structures deep inside). Before the fix, searching X
was adding 7-8 seconds onto the total time (which was only 13 seconds to start with). Post fix, negligible time added.
Any timeline on an updated globals
CRAN release?
globals 0.12.1 hit CRAN ~10 hours ago.
In future.apply 1.0.0,
future_lapply(X, ...)
searches alsoX
for possible globals (Issue #12). For longX
:s this introduces a significant overhead, especially ifX
does not contain any globals and we wouldn't have to searchX
in the first place. For example,All the slowness comes from an internal:
Following the code, this is slow because
is slow, which in turn is because it effetively does:
We might be able to speed up
globals::findGlobals()
a bit here,but don't know how much.[UPDATE 2018-06-20]: there was a low-hanging fruit in the globals package making it possible to speed this up lots, cf. https://github.com/HenrikBengtsson/globals/commit/566e3e9395ab5050387396c894b06fb099f96a66. I'll be running revdep checks on globals (first and and second generation dependencies) to make sure this doesn't break anything. If all ok, the need for working around this in future.apply is much smaller.Regardless, there could be a need for an argument controlling whetherX
should be searched for globals or not, especially since it is likely that in most use casesX
does not have globals.