Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

PERFORMANCE: Search large `X`:s for globals is slow [SOLVED]

Aperta
#13 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
15/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
r
Ambito
performance

Direzione di ricerca

L’issue riguarda future_lapply(X, ...) e la chiamata interna future::getGlobalsAndPackages(X, globals = TRUE), che raggiunge globals::findGlobals(X). Leggi quel percorso di chiamate e il commit collegato di globals; verifica se il rallentamento segnalato con X di grandi dimensioni è già stato risolto e se rimane qualche modifica da apportare in future.apply. Il lavoro è concluso quando l’issue viene documentata o chiusa dopo aver identificato che non rimangono altre azioni da intraprendere.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

enhancement

In future.apply 1.0.0, future_lapply(X, ...) searches also X for possible globals (Issue #12). For long X:s this introduces a significant overhead, especially if X does not contain any globals and we wouldn't have to search X in the first place. For example,

X <- vector("list", length = 100e3)
y <- future_lapply(X, FUN = identity)

All the slowness comes from an internal:

gp <- future::getGlobalsAndPackages(X, globals = TRUE)

Following the code, this is slow because

names <- globals::findGlobals(X)

is slow, which in turn is because it effetively does:

names <- lapply(X, FUN = globals::findGlobals)

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 whether X should be searched for globals or not, especially since it is likely that in most use cases X does not have globals.

Lingua principale
R
Stelle
219
Fork
20
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di futureverse/future.apply

Tutte le issue di futureverse/future.apply

Issue simili

Altre issue su R

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.