开发者

Suitability of C# for clustered calculation-heavy apps?

开发者 https://www.devze.com 2023-01-04 01:47 出处:网络
I\'m preparing to write a photonic simulation package that will run on a 128-node Lin开发者_运维知识库ux and Windows cluster, with a Windows-based client for designing jobs (CAD-like) and submitting t

I'm preparing to write a photonic simulation package that will run on a 128-node Lin开发者_运维知识库ux and Windows cluster, with a Windows-based client for designing jobs (CAD-like) and submitting them to to the cluster.

Most of this is well-trod ground, but I'm curious how C# stacks up to C++ in terms of real number-crunching ability. I'm very comfortable with both languages, but I find the superior object model and framework support of C# with .NET or Mono incredibly enticing. However, I can't, with this application, sacrifice too much in processing power for the sake of developer preference.

Does anyone have any experience in this area? Are there any hard benchmarks available? I'd assume that the the final machine code would be optimized using the same techniques whether it comes from a C# or C++ source, especially since that typically takes place at the pcode/IL level.


The optimisation techniques employed by C# and native C++ are vastly different. C# compilers emit IL, which is only marginally optimised and then JIT'ed to binary code when it is about to execute for the first time. Most of the optimisation work happens inside the JIT compiler.

This has pros and cons. JIT has time budgets, which limits how much effort it can expend on optimisation. But it also has intimate knowledge of the hardware it is actually running on, so it can (in theory) make transparent use of newer CPU opcodes and detailed knowledge of performance data such as a pipeline hazards database.

In practice, I don't know how significant the latter is. I do know that at least Mono will parallelise some loops automatically if it finds itself running on a CPU with SSE (SSE2, perhaps?), which may be a big deal for your scenario.


I did a quick search and found this:

http://www.drdobbs.com/184401976;jsessionid=232QX0GU3C3KXQE1GHOSKH4ATMY32JVN

Edit: Bear in mind (on reading the article) that this was done 5 years ago so performance is likely to be better all round!


I have found these performance comparisons:

http://reverseblade.blogspot.com/2009/02/c-versus-c-versus-java-performance.html
http://systematicgaming.wordpress.com/2009/01/03/performance-c-vs-c/
http://journal.stuffwithstuff.com/2009/01/03/debunking-c-vs-c-performance/
http://www.csharphelp.com/2007/01/managed-c-versus-unmanaged-c/

And here is even a case study:
http://www.itu.dk/~sestoft/papers/numericperformance.pdf

Hope it helps.

0

精彩评论

暂无评论...
验证码 换一张
取 消