views:

220

answers:

1

I have a .NET assembly(3.5 framework) and it basically has a set of custom controls which does a lot of things like plotting points and stuff like that. The assembly is compiled as 'AnyCPU' so that I can use it in both 32bit and 64bit. When I tried to compare the performance of an application that uses this assembly in 32bit and 64bit, I see interesting results. The application performance has 2 parts: One is the back end which does a lot of computations and data copying. The other is the actual drawing part on the control. Based on the results, it seems that the 1st part is faster in 32bit and while the 2nd part is faster in 64bit architecture. Can anyone explain this behavior? The data computation and copying part is slower in 64-bit is it because that the floating point arithmetic is slower in 64bit compared to 32bit?

PS: I benchmarked the application on 64-bit AMD machine with 8GB ram, with 32-bit and 64-bit Vista installed on it.

+2  A: 

If you have a lot of object references in your computation part, each reference is going to take up twice as much space in a 64-bit CLR, leading to increased memory usage and hence garbage collection. That's the main difference I can think of, but they also have different JITs - it could be that the computing part of your application happens to hit bits of the JIT where the 32 bit version is better.

Jon Skeet