Rethink data organization

Đang mở
#222 7 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
25/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
rust
Lĩnh vực
data-visualization

Hướng nghiên cứu

Bắt đầu bằng cách đọc API PlotPoints và PlotPoint hiện tại được mô tả ở đây, sau đó xem xét issue liên quan #76 và cuộc thảo luận gồm sáu bình luận. Để được coi là hoàn tất, cần có một phương án được thống nhất để thay thế đầu vào AoS bằng các slice xs và ys, bao gồm việc xử lý độ dài và quá trình di chuyển API có tính phá vỡ tương thích; issue không nêu tên tệp hoặc bài kiểm thử nào.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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

Ngôn ngữ chính
Rust
Star
494
Fork
110
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của emilk/egui_plot

Tất cả issue của emilk/egui_plot

Issue tương tự

Thêm issue về Rust

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.