我的32位头疼的是现在是一个64位的偏头痛?!? (或64位.NET CLR运行时的问题)我的、的是、是一个、偏头痛

2023-09-03 09:05:37 作者:我怎么这么闹啊@

有什么不寻常的,意想不到的后果发生在性能,内存方面,从在64位JIT与32位JIT运行的.NET应用程序切换时等?我感兴趣的是良好的,但更感兴趣的人都碰上了令人惊讶的糟糕的问题。

What unusual, unexpected consequences have occurred in terms of performance, memory, etc when switching from running your .NET applications under the 64 bit JIT vs. the 32 bit JIT? I'm interested in the good, but more interested in the surprisingly bad issues people have run into.

我在写一个新的.NET应用程序将被部署在32位和64位的过程。已经有有关该问题的应用程序移植的许多问题 - 我不关心的从编程/移植的角度来看的陷阱。 (即:互操作正确地处理本地/ COM,引用类型嵌入结构改变结构的大小等)

I am in the process of writing a new .NET application which will be deployed in both 32bit and 64bit. There have been many questions relating to the issues with porting the application - I am unconcerned with the "gotchas" from a programming/porting standpoint. (ie: Handling native/COM interop correctly, reference types embedded in structs changing the size of the struct, etc.)

然而,这个问题,并让我思考它的答案 - 还有什么其他问题,我俯瞰?

However, this question and it's answer got me thinking - What other issues am I overlooking?

已经有许多的问题和博客的裙子解决此问题,或者打它的一个方面,但是我还没有看到,被编译的问题一个体面的名单什么。

There have been many questions and blog posts that skirt around this issue, or hit one aspect of it, but I haven't seen anything that's compiled a decent list of problems.

在特定的 - 我的应用程序是非常CPU绑定,并且具有巨大的内存使用模式(因此需要64位摆在首位),以及作为图形的性质。我很担心其他隐藏的问题可能存在哪些在CLR或JIT运行在64位的Windows(使用.NET 3.5SP1)。

In particular - My application is very CPU bound and has huge memory usage patterns (hence the need for 64bit in the first place), as well as being graphical in nature. I'm concerned with what other hidden issues may exist in the CLR or JIT running on 64 bit Windows (using .NET 3.5sp1).

下面是我目前知道的几个问题:

Here are a few issues I'm currently aware of:

(现在我知道,)属性,甚至自动属性,不要内联的64位。 的应用程序更改内存配置文件,无论是因为大小引用的,也因为内存分配器具有不同的性能特征 Startup时间可以在x64 吃亏 (Now I know that) Properties, even automatic properties, don't get inlined in x64. The memory profile of the application changes, both because of the size of references, but also because the memory allocator has different performance characteristics Startup times can suffer on x64

我想知道还有哪些,具体的问题人们已经发现了在64位Windows中的JIT,并且如果有任何解决方法的性能。

I'd like to know what other, specific, issues people have discovered in the JIT on 64bit Windows, and also if there are any workarounds for performance.

感谢大家!

----编辑-----

----EDIT-----

只是为了澄清 -

据我所知,试图及早优化往往是不好的。我知道的第二个猜测,系统往往是不好的。我也知道,移植到64位都有自己的问题 - 我们运行和测试每日64位系统,以帮助这一点。等等。

I am aware that trying to optimize early is often bad. I am aware that second guessing the system is often bad. I also know that portability to 64bit has its own issues - we run and test on 64bit systems daily to help with this. etc.

我的应用程序,但是,是不是典型的商业应用。这是一个科学的软件应用程序。我们有一个坐在使用100%的CPU的所有内核(它的高度线程化的),在一个小时的时间很多的过程。

My application, however, is not your typical business application. It's a scientific software application. We have many processes that sit using 100% CPU on all of the cores (it's highly threaded) for hours at a time.

我花时间分析应用程序很多,这使得一个巨大的差异。然而,大多数剖析禁用JIT的许多特征,所以在像内存​​分配,内联的JIT等小细节,可以是非常困难的牵制,当你下一个分析器正在运行。因此,我需要的问题。

I spend a LOT of time profiling the application, and that makes a huge difference. However, most profilers disable many features of the JIT, so the small details in things like memory allocation, inlining in the JIT, etc, can be very difficult to pin down when you're running under a profiler. Hence my need for the question.

推荐答案

我记得从一个IRC频道我经常听到的一个问题。 它优化掉临时副本在这种情况下:

I remember hearing an issue from an IRC channel I frequent. It optimises away the temporary copy in this instance:

EventHandler temp = SomeEvent;
if(temp != null)
{
    temp(this, EventArgs.Empty);
}

把竞争状态回,并造成潜在的空引用异常。

Putting the race condition back in and causing potential null reference exceptions.