C#数学函数比C ++等价物慢得多!! !!
我们执行的简单比较测试表明,C#中的System.Math
函数比C ++中的相应函数慢得多。
极端的例子是System.Math.Exp ()和System.Math.Tan(),它们的平均值比它们的C ++对应物平均慢50倍。
(测试是使用优化的Release配置完成的。
Visual Studio环境。)
我们对这种大差异的解释是C#是一种
解释器语言。也许还有其他解释。在任何
的情况下,是否有人建议如何更快地评估C#数学函数
?更快?我们宁愿不必写我们的
了。
提前致谢。
Simple comparison tests we have performed show that System.Math
functions in C# are much slower than corresponding functions in C++.
Extreme examples are System.Math.Exp() and System.Math.Tan(), which
both seem to average 50 times slower than their C++ counterparts.
(Tests are done using optimized Release configurations outside the
Visual Studio environment.)
Our explanation for this large discrepancy is that C# is an
interpreter language. Perhaps there are other explanations. In any
case, does anyone have suggestions as to how the C# math functions can
be evaluated quicker? MUCH quicker? We''d rather not have to write our
own.
Thanks in advance.
" Ingmar" <在********** @ nibcapital.com>在消息中写道
news:9a ************************** @ posting.google.c om ...
"Ingmar" <in**********@nibcapital.com> wrote in message
news:9a**************************@posting.google.c om...
我们执行的简单比较测试表明,C#中的System.Math
函数比C ++中的相应函数慢得多。
极端的例子是System.Math.Exp()和System.Math.Tan(),它们的平均速度似乎比它们的C ++版本慢50倍。
(测试是在Visual Studio环境之外使用优化的发布配置完成的。) />
我们对这种巨大差异的解释是C#是一种
解释器语言。也许还有其他解释。在任何情况下,是否有人建议如何更快地评估C#数学函数?更快?我们宁愿不必写自己的。
Simple comparison tests we have performed show that System.Math
functions in C# are much slower than corresponding functions in C++.
Extreme examples are System.Math.Exp() and System.Math.Tan(), which
both seem to average 50 times slower than their C++ counterparts.
(Tests are done using optimized Release configurations outside the
Visual Studio environment.)
Our explanation for this large discrepancy is that C# is an
interpreter language. Perhaps there are other explanations. In any
case, does anyone have suggestions as to how the C# math functions can
be evaluated quicker? MUCH quicker? We''d rather not have to write our
own.
C#只是一种语言,你在谈论.NET。
并不解释.NET! :)非常重要的一点!!
无论如何,如果可以,请发布你的代码,因为你可能会做一些不合适的事情。
-c
C# is just a language, you''re talking about .NET.
And .NET is NOT interpreted! :) Very important point!!
Anyhow, please post your code if you can, because you
might be doing something inappropriate.
-c
你是否考虑了JIT编译时间第一次将
调到一个方法?
" Ingmar" <在********** @ nibcapital.com>在消息中写道
news:9a ************************** @ posting.google.c om ...
are you accounting for the JIT compile time that coours the very first time
that a method is called?
"Ingmar" <in**********@nibcapital.com> wrote in message
news:9a**************************@posting.google.c om...
我们执行的简单比较测试表明,C#中的System.Math
函数比C ++中的相应函数慢得多。
极端的例子是System.Math.Exp()和System.Math.Tan(),它们的平均速度似乎比它们的C ++版本慢50倍。
(测试是在Visual Studio环境之外使用优化的发布配置完成的。) />
我们对这种巨大差异的解释是C#是一种
解释器语言。也许还有其他解释。在任何情况下,是否有人建议如何更快地评估C#数学函数?更快?我们宁愿不必写自己的
提前致谢。
Simple comparison tests we have performed show that System.Math
functions in C# are much slower than corresponding functions in C++.
Extreme examples are System.Math.Exp() and System.Math.Tan(), which
both seem to average 50 times slower than their C++ counterparts.
(Tests are done using optimized Release configurations outside the
Visual Studio environment.)
Our explanation for this large discrepancy is that C# is an
interpreter language. Perhaps there are other explanations. In any
case, does anyone have suggestions as to how the C# math functions can
be evaluated quicker? MUCH quicker? We''d rather not have to write our
own.
Thanks in advance.
并不解释.NET! :)非常重要的一点!!
And .NET is NOT interpreted! :) Very important point!!
请原谅我这里的无知,但我一直以为.NET的核心是虚拟机
那个解释了字节码并管理了
的垃圾收集?我可能错了,请记住我来自一个java
环境。
pardon my ignorance here but I always thought .NET had a "virtual machine"
at its core, some engine that intrpreted the bytecode and managed the
garbage collection? I could be wrong, and keep in mind I come from a java
enviroment.