Fastest way to loop through a 2d array?

前端 未结 6 1258
余生分开走
余生分开走 2020-12-02 15:39

I just stumbled upon this blog post. The author shows two code samples that loop through a rectangle and compute something (my guess is the computing code is just a placehol

6条回答
  •  余生分开走
    2020-12-02 16:09

    Yeah, 'cache coherence'...of course it depends, you could optimize memory allocation for vertical scans. Traditionally video memory is allocated left-to-right, top-to-bottom, going back I'm sure to the days of CRT screens which drew scanlines the same way. In theory you could change this though--all this to say there isn't anything intrinsic about the horizontal method.

提交回复
热议问题