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 57554cc8b..b7674922c 100644 --- a/content/posts/newsletter-012/index.md +++ b/content/posts/newsletter-012/index.md @@ -136,6 +136,30 @@ surface. This demo is using [Rust-SDL2][rust-sdl2] for bindings. [sdl2-project]: https://www.libsdl.org/download-2.0.php [rust-sdl2]: https://crates.io/crates/sdl2 +### [An Introduction to Data-Oriented Design in Rust][dod] + +![vector vs linked list perf](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 + ## Library & Tooling Updates ### [wgpu][wgpu-site]