Page 1 of 1

64Bit optimize coding - My experience (AMD64)

PostPosted: 21 Dec 2005, 15:58
by Daniel Mehrmann
Hello,

i was starting to play with 64Bit coding weeks ago and could collect some
experince of my engine Homer. I don't know if it works for you or if it helps
you.

First i was reading a lot of stuff in the web about 64Bit coding and made my own
tries. I think the keypoint to become a high performance 64Bit programming are
the integer registers and how we should use this with a effective utilization.

I have a lot of tables and tables-lookup in my engine. My idea is here to go in
direction 64Bit. In the example code i have tables where i performed a bit AND
operation.

Standard 32Bit:
Code: Select all
int   a1[2048];
int   a2[2048];
int   a3[2048];

for (int i = 0; i < 2048; ++i)
    a3[i] = a1[i] & a2[i];


Changing here int to long long (unsigned __int64) brings a lot of speedup in
64Bit:

pure 64Bit:
Code: Select all
long long  a1[1024];
long long  a2[1024];
long long  a3[1024];

for (int i = 0; i < 1024; ++i)
     a3[i] = a1[i] & a2[i];


I don't changes the total size of the bit set block, mostly i don't need so much
space but here is the speed more importend ;)


I think there is allso a way for bit-counting stuff. But i'm testing currently
;)

Best,
Daniel