From 4f70a564ef6468d064b63d92881dada7ee0d4de6 Mon Sep 17 00:00:00 2001 From: James McMurray Date: Tue, 28 Jul 2020 23:12:04 +0200 Subject: [PATCH 1/2] Add data-oriented design article https://github.com/rust-gamedev/rust-gamedev.github.io/issues/201 --- .../newsletter-012/data_oriented_design.svg | 330 ++++++++++++++++++ content/posts/newsletter-012/index.md | 28 +- 2 files changed, 356 insertions(+), 2 deletions(-) create mode 100644 content/posts/newsletter-012/data_oriented_design.svg diff --git a/content/posts/newsletter-012/data_oriented_design.svg b/content/posts/newsletter-012/data_oriented_design.svg new file mode 100644 index 000000000..ec0ccd46c --- /dev/null +++ b/content/posts/newsletter-012/data_oriented_design.svg @@ -0,0 +1,330 @@ + + + +Gnuplot +Produced by GNUPLOT 5.4 patchlevel 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + + + + + + + + + + 2 + + + + + + + + + + + + + 4 + + + + + + + + + + + + + 6 + + + + + + + + + + + + + 8 + + + + + + + + + + + + + 10 + + + + + + + + + + + + + 12 + + + + + + + + + + + + + 14 + + + + + + + + + + + + + 16 + + + + + + + + + + + + + 18 + + + + + + + + + + + + + 20 + + + + + 0 + + + + + 500000 + + + + + 1x106 + + + + + 1.5x106 + + + + + 2x106 + + + + + 2.5x106 + + + + + 3x106 + + + + + 3.5x106 + + + + + 4x106 + + + + + 4.5x106 + + + + + 5x106 + + + + + + + + + Average time (ms) + + + + + Input + + + + + LinkedList + + + + + LinkedList + + + + + + gnuplot_plot_2 + + + + + + + + + + + + + + + + Vector + + + + + Vector + + + + + + gnuplot_plot_4 + + + + + + + + + + + + + + + + + + + + + + + + + + LinkedList: Comparison + + + + + + + diff --git a/content/posts/newsletter-012/index.md b/content/posts/newsletter-012/index.md index bb77e31a2..1e2333fad 100644 --- a/content/posts/newsletter-012/index.md +++ b/content/posts/newsletter-012/index.md @@ -36,6 +36,32 @@ Table of contents: - [Jobs](#jobs) - [Bonus](#bonus) +## Learning Material Updates + +### An introduction to Data-Oriented Design in Rust + +![Data-Oriented Design](data_oriented_design.svg) + +Data-Oriented Design is an approach to program optimisation focused on +considering the features and limitations of the target hardware, and +carefully controlling the memory layout of data to take advantage of +those. + +In [this article][dod], [jamesmcm][jamesmcm] provides benchmarks and +code for four example scenarios: + +- [Array of Structs vs. Struct of Arrays][wikisoa] +- Branching in a hot loop +- Iteration in a vector vs. a linked list +- Monomorphisation vs. [Dynamic Dispatch][traitobj] + +The full article is available [here][dod]. + +[jamesmcm]: https://github.com/jamesmcm +[wikisoa]: https://en.wikipedia.org/wiki/AoS_and_SoA +[traitobj]: https://doc.rust-lang.org/book/ch17-02-trait-objects.html#trait-objects-perform-dynamic-dispatch +[dod]: http://jamesmcm.github.io/blog/2020/07/25/intro-dod/#en +