jamesmcm / data-oriented-example

Example of Data Oriented Design in Rust

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

data-oriented-example

Experimenting with Data Oriented Design in Rust.

Written for this blog post: http://jamesmcm.github.io/blog/2020/07/25/intro-dod/#en

Done:

SoA gets unrolled by compiler, results in ~50% speed up. Godbolt: https://godbolt.org/z/d8bjMb

  • Benchmark of pattern matching inside hot loop vs. outside

Outside results in 50% speed up.

  • Benchmark of Linked List iteration vs. contiguous Vector

Vector shows consistent 90% speed up vs. Linked List iteration

  • Benchmark of dynamic dispatch vs. monomorphisation

Dynamic dispatch impedes vectorisation due to indirection, otherwise cost of lookup in vtable is small

About

Example of Data Oriented Design in Rust


Languages

Language:Rust 100.0%