Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IDEA: Improve performance by early skipping in findGlobals() #39

Open
HenrikBengtsson opened this issue Jun 21, 2018 · 0 comments
Open

Comments

@HenrikBengtsson
Copy link
Owner

I've just made globals::findGlobals(X) significantly faster when X is long and contain lots of elements with basic data types. The gist of this improvement is to skip elements "early" that cannot contain globals:

types <- unlist(lapply(expr, FUN = storage.mode), use.names = FALSE)
keep <- which(!(types %in% c("logical", "integer", "double", "complex", "character", "raw", "NULL")))
globals <- lapply(expr[keep], FUN = findGlobals, ...)

Idea

Can this approach be done efficiently also in a nested approach, e.g. when X is a list of lists? Can it be done efficiently using plain R code, or do we need to implement this is native code? If we go for native code, other parts of the package could also go native - there's a lot of "walking" around in structures going on.

HenrikBengtsson added a commit that referenced this issue Jun 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant