Writing Performant Concurrent Data Structures by Adrian Alic - Rust Zürisee March 2023

Write performant concurrent data structures for your application by considering the language's semantic and memory models, optimizing for specific use cases, and applying techniques like caching, pointer compression, and parallelism cautiously.

Key takeaways
  • Write performant concurrent data structures adaptive to the underlying architecture.
  • Be aware of the language’s semantic model and memory model.
  • Use caching of offsets to optimize performance.
  • Consider the usage of cache padded data structures.
  • Use pointer compression to reduce memory overhead.
  • Do not rely on undefined behavior.
  • Ensure correct memory ordering to avoid potential issues.
  • Optimize for the specific use case and problem domain.
  • Use parallelism cautiously to avoid cache thrashing.
  • Accumulate and reason about the performance characteristics of the data structure.
  • Use compile-time evaluation and type inference to ensure correctness and efficiency.
  • Do not assume the worst-case scenario and instead optimize for the average case.
  • Understand the queue’s semantics and how to perform masking and early termination.
  • Use safe, idiomatic Rust code to reduce bugs and improve maintainability.
  • Learn from others and acknowledge the importance of code reviews and testing.