.Net2 assemblies hosted in .Net4 app perform better in x86 than in AnyCpu mode?
Asked Answered
T

2

5

I have a .Net4 WinForms app that references 3rd party .Net2 assemblies, which contain graphics-heavy visual controls. I've noticed a huge improvement in app's visual performance when I accidentally switched it from AnyCpu to x86 compilation mode. My development rig is a x64 Windows 7. The improvement is by a factor of at least two when controls are rendering their graphical elements.

Is this a known fact or am I doing something wrong?

Turfman answered 23/8, 2011 at 12:33 Comment(0)
K
3

See these two articles about it:

AnyCPU Exes are usually more trouble than they're worth

Visual Studio: Why is there no 64 bit version? (yet)

See also this post about 64-bit code: Should I choose to take advantage of 64-bit?, it clearly states that for example Paint.NET works better under in 64-bit mode, because the developer optimized the code for 64-bit.

So, I don't think you are doing something wrong, but maybe the 3rd party .NET assemblies you're using could be improved specifically when running in a 64-bit process.

Knipe answered 23/8, 2011 at 16:41 Comment(1)
Those other assemblies use managed drawing routines from System.Drawing (which IIRC just wrap GDI+ calls), so I'm not sure how could they be improved for 64bit, since there are no platform-specific optimizations in managed .Net (that I know of).Turfman
F
2

This wouldn't surprise me. When you set the application to compile to "Any CPU", the CLR generates an application that the jiter on the user's machine must further compile to best fit their architecture. If you set it to "x86", your dev compiler compiles the application for an x86 machine, which reduces the load of the clients jiter.

Fading answered 23/8, 2011 at 16:25 Comment(3)
Sorry. JIT stands for "Just in Time" and the reference to a JITer means the "just-in-time" compiler that compiles the IL code into machine code specific for the users machine when the application is first launched.Fading
I know what is JIT compiler but never used to see JITer as JIT compiler.Bathilda
Ok, but I doubt that JIT compilation has that much of an impact. It's not like only the loading of the app is slower or first-time running of different modules, but the overall app's performance is noticeably poorer.Turfman

© 2022 - 2024 — McMap. All rights reserved.