double-buffer

Crates.iodouble-buffer
lib.rsdouble-buffer
version1.0.0
sourcesrc
created_at2023-09-26 18:19:30.419454
updated_at2023-11-16 08:05:23.805564
descriptionA simple double buffer generic implementation
homepage
repositoryhttps://github.com/jhg/double-buffer-rs
max_upload_size
id983943
size26,923
Jesus Hernandez (jhg)

documentation

README

Generic and simple double buffer

This only provides DoubleBuffer<T>, for implementing a double buffer pattern.

DoubleBuffer<T> is not limited to bytes arrays or similar buffers, it can be used with any type that requires modify while reading current state and all the changes look as one atomic operation.

Swapping Benchmarks

The following are the results in a i7 10th gen with 32GB RAM for a vec![0u8; 16777216] buffer:

  1. DoubleBuffer::swap() - 1.6655 ns 1.6814 ns 1.6964 ns
  2. DoubleBuffer::swap_with_default() - 1.7547 ns 1.8009 ns 1.8262 ns
  3. DoubleBuffer::swap_with_clone() - 4.4526 ms 4.5241 ms 4.5989 ms
Commit count: 24

cargo fmt