fixedbitset icon indicating copy to clipboard operation
fixedbitset copied to clipboard

Return old values in `set` (and potentially other methods)

Open SUPERCILEX opened this issue 3 years ago • 0 comments

Potential performance optimization for a pattern like this:

if !received[id] {
  received[id] = true;
  // Do other stuff
}

// Could be this instead
if !received.set(id, true) {
  // Do other stuff
}

It would need some benchmarking to make sure the bounds checking and division is actually slow enough to warrant a memory read on every set call.

SUPERCILEX avatar Apr 03 '22 22:04 SUPERCILEX