Performance for C code

I looked around and was not sure where best to post this question...this won out over all.

Question...

I have legacy C code that employs heavy duty graphics algorithms ... internally quite a few of them sit on use of a WORD data type. At the time of their development memory was not as it is today and so a WORD data type with max value of 65k was enough to satisfy any requirements.
In convsersation someone recently spoke about the use of WORD vs. DWORD with today's compiler optimizations and performance on 32bit processors. If I rework the algos to utilize a DWORD vs. WORD I understand I will eat up more memory but the benefits are said to be incredible regarding performance.

I don't really see how much performance would be affected so any opinions on this topic would be greatly appreciated.


Answer this question

Performance for C code

  • Dean Kalanquin

    Generally operations that use the full word size will be faster since if these are operatios working on units of less than word size you might be able to do twice as many in one operation or if you still only are using 16 bits the CPU will at least not need to do any masking.

    You will need to try it out and see by how much performance improves, but I would think it is highly unlikely that you will see benefits I would classify as "incredible".

    Ronald Laeremans
    Visual C++ team

  • Steve Cochran

    Because a 32 bit processor's registers are DWORDs and any operations with DWORDs will be faster..... basically.

  • Performance for C code