Rethink data organization

オープン
#222 コメント 7 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
25/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
rust

調査の方向性

まず、ここで説明されている現在の PlotPoints および PlotPoint API を読み、その後、関連する issue #76 と6件のコメントからなる議論を確認してください。完了とするには、AoS 入力を xs および ys スライスに置き換えるための合意された方針が必要です。これには長さの扱いと、破壊的な API 移行を含みます。この issue ではファイルやテストは指定されていません。

索引モデルが issue の本文から書いたものです。

説明

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

主要言語
Rust
スター
494
フォーク
110
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

emilk/egui_plot のほかの issue

emilk/egui_plot の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。