Code Red > .NET

Really a difference with float, int, double

<< < (2/2)

MickD:

I don't know how much the C# compiler optimises memory for class variables but in C/C++ it can be important to 'byte align' your variables to make them easier to access in 32/64 bit lumps but that is probably less important than how you structure your routines and bulk data (cache misses can have a ~200X speed factor hit on cpu performance!). That is, it is more efficient to grab your functions and variables and hope they fit in the cache (say L1/L2) and then run them as much as you can before retrieving the next lot of code and data.
So yes, it _can_ be important if you are coding for embedded systems or VR/Games/Animation.

Given that, unless you are trying to perform gig's of calculations at 60 frames per second then it's not worth worrying about, even if it was slower using doubles over floats we're talking milliseconds 'difference' per run of routine. If this is really important then I wouldn't be using any language that's interpreted or that runs on a VM like C#.

hth

It's Alive!:
Yes, they can make a huge difference if you're using SIMD, google SIMD-enabled types for .NET

SSE2 XMM registers:
    four 32-bit single-precision floating point numbers
    two 64-bit double-precision floating point numbers or
    two 64-bit integers or
    four 32-bit integers or
    eight 16-bit short integers or
    sixteen 8-bit bytes or characters.

Otherwise probably not, just use the type that you need

Navigation

[0] Message Index

[*] Previous page

Go to full version