OFF-TOPIC

--


Sijmen Mulder wrote:

On a game development forum, someone asked what method of storing 2D
arrays is faster. On .NET, there are three possibilities:

1. [y*width+x]
2. [x,y]
3. [x][y]

4. [offset + x]

offset = columOffset[y]
cellContent = map[ offset + x ]

will be need to populate columoffset with values:

 columOffset[i]= (i - 1) * width

I cheat because I dont use a 2D array. I know is Ok to cheat coding videogames, anyway. You dont really need to draw 2 zimbillions of trigs If you can cheat and draw only 200 and gamers will not notice.


I was wondering too, so I wrote a benchmarker.

cool.

I attached the source
and the results (as pdf). The results are remarkable!


where? maybe this mail list remove attchs.

With all methods with all resolutions, Mono -is- slowest. Until..
maximum optimalization is used. Then the Mono results are about 5
times as good as with Microsoft.NET. Another weird thing is that
normally, method 1 is way faster, but when Mono is used with maximum
optimalization, method 2 is faster. And when the version with a
resolution of a power of two is ran, both method 2 and 3 are faster.
Just take a look at the pdf :)


Looks like you may need to force il code and compare what code is generated. You are optimizing very tigth loops, so its critical the compiler optimizations. Its Mono cool enough to temporaly disable optimizations???


#pragma disable "inline expansion"

code that work better with inline disabled

#pragma enable "inlince expansion"

????

Even gamercoders get more speed switching to better algoritms. You can't optimize bubblesort beyond some limit. Better algoritms exist out here for most stuff... Compiler oriented optimizations may result slow with a different compiler, version, client hardware, etc..

--Tei
_______________________________________________
Mono-list maillist  -  [EMAIL PROTECTED]
http://lists.ximian.com/mailman/listinfo/mono-list

Reply via email to