9 votes

Game of life(random generation)

Using attributes Why is iteration passed into the LifeGame.print function? This makes more sense to me as an attribute on ...
6 votes

Game of life(random generation)

You explain that you wish to improve CPU consumption but you don't know where to begin. Always start optimizing by asking "where did the cycles go?" Run the profiler: ...
  • 9,138
4 votes

Single Producer Single Consumer lockless ring buffer implementation

Few things in addition to already two great answers. 'Theoretically' this is as fast a single producer single consumer ring buffer can can get in a modern processor (larger read/write commit batches ...
3 votes

Moving increments into condition checks?

A couple of things: First: those two code samples are not actually identical functionally. In terse, the memory address at s is set to t and then the value at s is evaluated to determine if it's the ...
2 votes

Find factor pairs of an integer in Rust

My solution with a custom iterator runs almost 2x faster. Your main bottleneck is the multi_cartesian_product iterator that produces results on the heap (...

Only top scored, non community-wiki answers of a minimum length are eligible