7 ms·
One simple branchless optimization form I've used is collision detection across an array of values: instead of testing each one, i add their value to a counter(
by chipsy 11y ago
One simple branchless optimization form I've used is collision detection across an array of values: instead of testing each one, i add their value to a counter(perhaps with some mapping of data to collision value). After iterating over a lot of them, I can do just one test. This is very cpu-friendly as the pipeline gets to crunch all the numbers in one go.
- 1_player 11y agoSounds interesting, can you provide a code example?
- chipsy 11y agoThe example I was going to provide [0] it turns out was reduced into a memory comparison. I wrote a little C program for you instead: [1] [0] https://github.com/triplefox/three-packer/blob/master/packer/packer/pack.nim#L375 https://github.com/triplefox/three-packer/blob/master/packer... [1] https://gist.github.com/triplefox/47d620fc556e3f7da9bb https://gist.github.com/triplefox/47d620fc556e3f7da9bb