为什么在嵌套循环中C#450比C ++慢450? [英] Why is C# 450% slower than C++ on nested loops ??

查看:54
本文介绍了为什么在嵌套循环中C#450比C ++慢450?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

http://www.tommti-systems.de/go.html...enchmarks.html

上面的链接显示C#是450像嵌套

循环这样简单的东西要慢一些。这是因为.NET内在速度较慢,还是C#编译器只是生成代码而不是像C ++编译器那样优化?

http://www.tommti-systems.de/go.html...enchmarks.html
The above link shows that C# is 450% slower on something as simple as a nested
loop. Is this because .NET is inherently slower or does the C# compiler merely
produce code that is not as well optimized as the C++ compiler?

推荐答案

对于那些想了解更多关于为什么这个问题被问到的问题的人,请看以下链接:

http://groups.google.com/group/micro...cc573d00467eec


大量的回复,以及OP对于.NET和CLR的性质的误解了。


-

- Nicholas Paldino [.NET / C#MVP]

- mv*@spam.guard.caspershouse.com


" Peter Olcott" <醇**** @ att.net>在消息中写道

news:l_Asf.38059
For those that would like more information on why this question is being
asked, see the following link:

http://groups.google.com/group/micro...cc573d00467eec

A good amount of the reply, and the OPs misunderstanding of the nature
of .NET and the CLR is in this thread.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Peter Olcott" <ol****@att.net> wrote in message
news:l_Asf.38059


QW2.19657@dukeread08 ...
QW2.19657@dukeread08...

http://www.tommti-systems.de/go.html...enchmarks.html
上面的链接显示C#在简单的事情上慢了450%嵌套循环。这是因为.NET本身速度较慢,还是C#
编译器只生成不像C ++编译器那样优化的代码?

http://www.tommti-systems.de/go.html...enchmarks.html
The above link shows that C# is 450% slower on something as simple as a
nested loop. Is this because .NET is inherently slower or does the C#
compiler merely produce code that is not as well optimized as the C++
compiler?


" Nicholas Paldino [.NET / C#MVP]" < mv*@spam.guard.caspershouse.com>写在

消息新闻:em ***************** @ tk2msftngp13.phx.gbl ...
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:em*****************@tk2msftngp13.phx.gbl...
对于那些想了解更多关于为什么要问这个问题的信息,请看以下链接:

http://groups.google.com/group/micro...cc573d00467eec

那么看来你的争用(根据链接指向的消息

to)是因为C#

编译器生成的代码较差所致。

答案量很大,且OP误解了.NET的本质和CLR就在这个主题中。

-
- Nicholas Paldino [.NET / C#MVP]
- mv*@spam.guard.caspershouse.com

Peter Olcott <醇**** @ att.net>在消息中写道
新闻:l_Asf.38059
For those that would like more information on why this question is being
asked, see the following link:

http://groups.google.com/group/micro...cc573d00467eec
So then it seems that your contention (based on the message that the link points
to) is that the whole difference is because of poorer code generation by the C#
compiler.

A good amount of the reply, and the OPs misunderstanding of the nature of
.NET and the CLR is in this thread.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Peter Olcott" <ol****@att.net> wrote in message
news:l_Asf.38059


这篇关于为什么在嵌套循环中C#450比C ++慢450?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆