Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

2d array optimization

Name: Anonymous 2010-01-20 6:59

I'm writing some program (C++) which will heavily depend on bitmaps... and it needs to be ultrafast.
I thought of implementing:
- 2d arrays: bitmap[y][x]=0xdeadbeef;
- 1d arrays: bitmap[y_+x]=0xdeadbeef; where y_ = y*w, recalculated as rarely as possible
- vectors.
The point is it needs to be fast. I will often need to traverse every bitmap's cell in usual order (y=0..h, x=0..w). Having that in mind, which of the options above is the best?

Name: Anonymous 2010-01-25 4:24

>>10
That's what I did for this obscure data mining project I was working on several months ago. Sped up a critical algorithm's inner loop by around 700%.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List