Rethink data organization

Aperta
#222 7 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
25/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
rust

Direzione di ricerca

Inizia leggendo l’API attuale di PlotPoints e PlotPoint descritta qui, quindi esamina l’issue correlata #76 e la discussione di sei commenti. Per considerare il lavoro completato, è necessario concordare un approccio per sostituire l’input AoS con slice xs e ys, inclusa la gestione delle lunghezze e la migrazione dell’API con modifiche incompatibili; l’issue non indica file né test.

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

Descrizione

good challenging issue planning

Currently you need to pass PlotPoints resp. Vec<PlotPoint { x, y }> as inputs for plotting. This is called AoS (array-of-structures). AoS is in my humble opinion not as good as SoA.

Reasoning

AoS is inefficient:

  1. A common use-case for plotting is time-series plots, with shared x-axis. The AoS forces you to make a copy of xs for each line plot, ~doubling memory requirements.
  2. It does not allow to slice data efficiently, i.e. to manage ranges of data given current plot bounds.
  3. Poorer cache locality for typical access patterns (e.g. compute min/max for plot bounds)
  4. It is hard to extend. Some plot items may require more data (i.e. recently colormap) which forces every user of PlotPoint to pass even more data, which may not be used at all, and breaks public API every time.

Better alternative in terms of performance is generally SoA (structure-of-arrays):

  1. SoA better aligns with SIMD / most graphics APIs and shaders prefer SoA-like layouts.
  2. Addresses weakness points of AoS.

Disadvantages of SoA:

  1. xs and ys must have the same length, but this is no longer enforced by the type system - requires runtime checks or truncation.
  2. Passing two slices is more verbose than a single Vec.

Proposal

Proposal is to get rid of Vec<PlotPoint { x, y }> and instead pass xs: &[f32] and ys: &[f32]).
This would be a major breaking change.

Related PRs/issues

#76

Lingua principale
Rust
Stelle
494
Fork
110
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 emilk/egui_plot

Tutte le issue di emilk/egui_plot

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.