[refactor]: merge multiple models into singular file for standard output

Aperta
#457 11 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
48/100
Tipo di issue
Refactoring
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
r
Ambito
data

Direzione di ricerca

Start by reading the standard-output code that creates the tables and figures, and trace where it currently passes a list of data frames; the issue does not name specific files or tests. Check whether those data frames share a schema and how the outputs consume them. Done means the outputs use a single data frame and the package's relevant tests pass.

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

Descrizione

enhancement

We should feed in a single df to all tables and figures rather than a list. Especially to aid in memory issues. See rationale below:

Memory wise, it is more efficient to have a dataframe rather than a list. I am thinking that if we actually move to parquet files/databases that the list of dataframes would be the least efficient way to store this information in R. And, according to Gemini

A single consolidated data frame is significantly more memory-efficient and performant than a list of many small data frames, assuming the data frames share the same schema. Every R object carries structural overhead (class definitions, attributes, dimensions, and names). If you store thousands of small data frames in a list, R maintains thousands of separate attribute vectors and column names. Consolidating into one table collapses that metadata into a single set. R's vector engine operates on contiguous blocks of memory. Iterating over elements in a list (e.g., via lapply() or purrr::map()) incurs call-stack overhead and traverses fragmented pointers across the heap, whereas column operations on a single data frame utilize SIMD vectorization and cache locality. The R garbage collector tracks every allocated node (Vcells and Ncells). Having a large list of separate data frames balloons the total count of distinct objects, forcing the garbage collector to run frequently and cause execution pauses.
A list of data frames is only preferable if:

  1. The structures differ: The tables do not share common columns or types, making a combined table sparse or full of NA padding.
  2. Independent lifecycle: You frequently delete, update, or process chunks independently and want to let R selectively garbage-collect individual pieces without rewriting a massive master table.

Originally posted by @kellijohnson-NOAA in #455

Lingua principale
R
Stelle
20
Fork
10
Merge medio
3g 22h
PR unite (30g)
26

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

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 nmfs-ost/stockplotr

Tutte le issue di nmfs-ost/stockplotr

Issue simili

Altre issue su R

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.