C ++与C#对比汇编语言 [英] C++ vs. C# vs. Assembly Language

查看:77
本文介绍了C ++与C#对比汇编语言的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

只是想知道,


您认为性能差异是什么?


(1。)编译C#

(2。)编译的C ++

(3。)和汇编语言

如果有的话,如果有的话,混合是怎样的对于SQL Server数据库,语言必须达到



如果你必须使用
$ b $,差异会有多大或多少不同b ASP.NET?


我想,我问的是汇编语言将如何影响整体

的表现?


并且有人用汇编语言编码吗?


谢谢。

解决方案

" NOSPAM" < n@ntspam.com>在消息中写道

新闻:#b ************* @tk2msftngp13.phx.gbl ...

只是想知道,

你认为性能差异是什么?

(1。)编译C#


C#编译成MSIL,是与机器无关的代码。代码是运行时JIT-ted(即时编译)到本机代码。

(2。)编译C ++


C ++编译器生成不同的输出,具体取决于它是否与

或没有.NET(/ clr编译器选项)一起使用。使用/ clr选项,输出与B#相同(除了更好的托管 - 非托管互操作性/ b $ b功能和更糟糕的代码可读性)。没有它,它会直接编译为原始汇编代码。

(3。)和汇编语言


你是什么?用汇编语言表示?如果你的意思是x86汇编程序,那么我确实认为这是迄今为止最糟糕的方式。如果你的意思是MSIL,我猜它是b / b
在其中编写代码毫无意义,因为它非常高级。并且

你可能无法编写比C#或其他

编译器生成的代码更好的代码...

如何混合如果这些语言中的任何一种语言必须针对SQL Server数据库进行打击


???

并且差异会更大或是不太常见的是你必须使用ASP.NET吗?


???

我想,我想问的是汇编语言将如何影响
整体表现?


???

还是有人用汇编语言代码吗?


嗯,所以我猜你说的是x86程序集......首先,我不是真的

了解你想要访问的方式SQL Server甚至更少的ASP.NET

来自它,这需要托管环境(汇编程序不是,而且永远不可能是
)。至于代码的速度,你可能会发现你的
汇编代码比任何编译器生成的汇编代码都要慢,因为编译器知道这个代码。处理器如何执行指令,b $ b缓存数据等。缓存未命中,页面错误和类似的事情是现代世界中最大的性能生猪。考虑到所有这些事情,很难在

汇编中编写代码,并且编译器将轻松地制作所有这些

的东西。甚至没有提到诸如面向对象的程序之类的东西,这是你在组装时永远无法做到的。有关更多

参考,请参阅
http://msdn.microsoft.com/library/de...anagedcode.asp

谢谢。




请不要发布到这么多团体。根据我的观点,这个问题属于

microsoft.public.dotnet.framework.performance。


希望这有帮助,

Stefan


" nospam" < n@ntspam.com>在消息中写道

新闻:#b ************* @tk2msftngp13.phx.gbl ...

只是想知道,

你认为性能差异是什么?

(1。)编译C#


C#编译成MSIL,是与机器无关的代码。代码是运行时JIT-ted(即时编译)到本机代码。

(2。)编译C ++


C ++编译器生成不同的输出,具体取决于它是否与

或没有.NET(/ clr编译器选项)一起使用。使用/ clr选项,输出与B#相同(除了更好的托管 - 非托管互操作性/ b $ b功能和更糟糕的代码可读性)。没有它,它会直接编译为原始汇编代码。

(3。)和汇编语言


你是什么?用汇编语言表示?如果你的意思是x86汇编程序,那么我确实认为这是迄今为止最糟糕的方式。如果你的意思是MSIL,我猜它是b / b
在其中编写代码毫无意义,因为它非常高级。并且

你可能无法编写比C#或其他

编译器生成的代码更好的代码...

如何混合如果这些语言中的任何一种语言必须针对SQL Server数据库进行打击


???

并且差异会更大或是不太常见的是你必须使用ASP.NET吗?


???

我想,我想问的是汇编语言将如何影响
整体表现?


???

还是有人用汇编语言代码吗?


嗯,所以我猜你说的是x86程序集......首先,我不是真的

了解你想要访问的方式SQL Server甚至更少的ASP.NET

来自它,这需要托管环境(汇编程序不是,而且永远不可能是
)。至于代码的速度,你可能会发现你的
汇编代码比任何编译器生成的汇编代码都要慢,因为编译器知道这个代码。处理器如何执行指令,b $ b缓存数据等。缓存未命中,页面错误和类似的事情是现代世界中最大的性能生猪。考虑到所有这些事情,很难在

汇编中编写代码,并且编译器将轻松地制作所有这些

的东西。甚至没有提到诸如面向对象的程序之类的东西,这是你在组装时永远无法做到的。有关更多

参考,请参阅
http://msdn.microsoft.com/library/de...anagedcode.asp

谢谢。




请不要发布到这么多团体。根据我的观点,这个问题属于

microsoft.public.dotnet.framework.performance。


希望这有帮助,

Stefan





x86汇编形式的汇编语言很少用于
开发桌面或分布式应用程序,它更适合用于微控制器的系统级操作系统或嵌入式软件等。虽然很好

编写的程序集会胜过大多数编译语言,如果系统是依赖于数据库访问的
,那么数据库将成为瓶颈,因此

汇编代码不会产生太大的影响。由于复杂性和缺乏对象

导向构造,程序集在开发时间上也会带来一个b
的服务器开销。


随着关于C#和非托管C ++,我认为这确实是一个案例

你喜欢的语言。但是,在我看来,C#将极大地缩短您的开发时间并帮助提供更强大的系统。

在托管系统中运行所带来的性能损失是不是那个

重要的是从垃圾收集中获得的好处,

结构化异常处理等。另一方面,托管C ++提供了许多的b $ b C#在开发时间和代码安全性方面的好处

,同时仍然允许您使用您习惯的C ++库。恕我直言,使用托管C ++的主要问题是托管C ++不可验证的事实因为CLR并不是所有代码都必须是安全的,而C#允许你/>
来决定你是否编写100%安全可验证的代码

或者你准备没收可验证性并使用不安全的代码。


如果您对Assembly的引用实际上是对IL代码的引用,那么在这种情况下我认为使用IL生成应用程序

是完全可行的。 IL允许您使用某些更高级.NET语言(如C#)暴露的功能,但仍然可以为您提供优惠面向对象的代码和结构化的异常

处理等等。然而IL再次更细粒度因此

增加你将要输入的代码的物理量,它是比C#更可读b $ b(虽然IL非常易读!)。

在所有情况下,一旦涉及数据库,我相信

性能在很大程度上取决于您的数据库和数据库设计。并且

您应该选择最容易转换为业务的语言

您要解决的问题。


希望这个帮助


Chris Taylor


" nospam" < n@ntspam.com>在消息中写道

news:%2 ***************** @ tk2msftngp13.phx.gbl ...

Just想知道,

你认为性能差异是什么?

(1.)编译C#
(2。)编译C ++
( 3.)和汇编语言

如果这些语言中的某些语言必须针对SQL Server数据库打击,那将是如何混合的

差异或多或少是不同的你必须使用
ASP.NET?

我想,我问的是汇编语言将如何影响
整体表现?
谢谢。



Just wondering,

What do you think the difference in performance would be between

(1.) Compiled C#
(2.) Compiled C++
(3.) and Assembly Language

And how would the mix be if some if any of these languages had to hit
against a SQL Server database

And would the differences be more or less different is you had to use
ASP.NET?

I guess, what I am asking is how would Assembly Language affect the overall
performance?

And does anyone code in assembly language anyway??

Thanks.

解决方案

"nospam" <n@ntspam.com> wrote in message
news:#b*************@tk2msftngp13.phx.gbl...

Just wondering,

What do you think the difference in performance would be between

(1.) Compiled C#
C# gets compiled to MSIL, which is a machine independent code. The code is
JIT-ted (just-in-time compiled) during runtime, into native code.
(2.) Compiled C++
The C++ compiler generates different output depending on if it''s used with
or without .NET (/clr compiler option). With the /clr option, the output is
much the same as from C# (except for much better managed-unmanaged interop
capabilities and much worse code readability). Without it, it gets compiled
directly to native assembly code.
(3.) and Assembly Language
What do you mean by assembly language? If you mean x86 assembler, then I
really think it''s by far the worst way to go. If you mean MSIL, I guess it
would be pointless to write code in it, because it''s pretty "high-level" and
you probably couldn''t write better code than that generated by C# or other
compiler...

And how would the mix be if some if any of these languages had to hit
against a SQL Server database
???

And would the differences be more or less different is you had to use
ASP.NET?
???

I guess, what I am asking is how would Assembly Language affect the overall performance?
???

And does anyone code in assembly language anyway??
Well, so I guess you are talking the x86 assembly... First, I don''t really
understand the way you would like to access SQL Server and even less ASP.NET
from it, which requires managed environment (assembler isn''t and never could
be). As for the speed of the code, you would probably find out that your
assembly code is slower than the one generated by any of the compilers, as
the compilers know the ways how does the processor execute instructions,
cache data, etc. Cache misses, page faults and similar things are the
biggest performance hogs in the modern world. It''s hard to write code in
assembly with all such things in mind, and a compiler will make all these
things easily. Not to even mention things such as object oriented
programming, which you''ll never be able to do in assembly. For more
reference, see
http://msdn.microsoft.com/library/de...anagedcode.asp.

Thanks.



Please don''t post to so many groups. By my opinion, this question belongs to
microsoft.public.dotnet.framework.performance.

Hope this helps,
Stefan


"nospam" <n@ntspam.com> wrote in message
news:#b*************@tk2msftngp13.phx.gbl...

Just wondering,

What do you think the difference in performance would be between

(1.) Compiled C#
C# gets compiled to MSIL, which is a machine independent code. The code is
JIT-ted (just-in-time compiled) during runtime, into native code.
(2.) Compiled C++
The C++ compiler generates different output depending on if it''s used with
or without .NET (/clr compiler option). With the /clr option, the output is
much the same as from C# (except for much better managed-unmanaged interop
capabilities and much worse code readability). Without it, it gets compiled
directly to native assembly code.
(3.) and Assembly Language
What do you mean by assembly language? If you mean x86 assembler, then I
really think it''s by far the worst way to go. If you mean MSIL, I guess it
would be pointless to write code in it, because it''s pretty "high-level" and
you probably couldn''t write better code than that generated by C# or other
compiler...

And how would the mix be if some if any of these languages had to hit
against a SQL Server database
???

And would the differences be more or less different is you had to use
ASP.NET?
???

I guess, what I am asking is how would Assembly Language affect the overall performance?
???

And does anyone code in assembly language anyway??
Well, so I guess you are talking the x86 assembly... First, I don''t really
understand the way you would like to access SQL Server and even less ASP.NET
from it, which requires managed environment (assembler isn''t and never could
be). As for the speed of the code, you would probably find out that your
assembly code is slower than the one generated by any of the compilers, as
the compilers know the ways how does the processor execute instructions,
cache data, etc. Cache misses, page faults and similar things are the
biggest performance hogs in the modern world. It''s hard to write code in
assembly with all such things in mind, and a compiler will make all these
things easily. Not to even mention things such as object oriented
programming, which you''ll never be able to do in assembly. For more
reference, see
http://msdn.microsoft.com/library/de...anagedcode.asp.

Thanks.



Please don''t post to so many groups. By my opinion, this question belongs to
microsoft.public.dotnet.framework.performance.

Hope this helps,
Stefan


Hi,

Assembly language in the form of x86 assembly would seldom be used to
develop a desktop or distributed type application, it is more suited to
system level OS or embedded software for microcontrollers etc. Though well
written Assembly would outperform most compiled languages, if the system is
relying on database access the database becomes the bottle neck so the
Assembly code would not make much difference. Assembly would also carry a
sever overhead on development time due to the complexity and lack of object
oriented constructs.

With regard to C# and unmanaged C++, well I think that this is really a case
of your preference in languages. However, in my opinion, C# will drastically
short-circuit your development time and help provide a more robust system.
The performance penalty incurred by running in a managed system is not that
significant inlight of the benefits gained from garbage collection,
structured exception handling etc. On the other hand managed C++ provides
many of the benefits of C# in terms of development time and code security
while still enabling you to use the C++ libraries you are used to. IMHO, the
major catch with managed C++ is the fact that managed C++ is not verifiable
by the CLR therefore not all code is necessarily secure, while C# allows you
to make the decision as to whether you writing 100% safe and verifiable code
or you are prepared to forfeited verifiability and use unsafe code.

If your reference to Assembly was actually a reference to the IL code, in
that case I believe that it is quite feasible to generate a application
using IL. IL would allow you to make use of features that are yet to be
exposed by some of the higher level .NET languages such as C#, while still
giving you the benefits of object oriented code and structured exception
handling etc. Once again however the IL is much more fine grained therefore
increasing the physical amount of code you will be typing and it is less
readable than C# (though the IL is very readable!).

In all cases, once there is a database involved, I believe that the
performance is largely dependant on you database and database design. And
you should choose the language that most easily translates to the business
problem you are trying to solve.

Hope this helps

Chris Taylor

"nospam" <n@ntspam.com> wrote in message
news:%2*****************@tk2msftngp13.phx.gbl...

Just wondering,

What do you think the difference in performance would be between

(1.) Compiled C#
(2.) Compiled C++
(3.) and Assembly Language

And how would the mix be if some if any of these languages had to hit
against a SQL Server database

And would the differences be more or less different is you had to use
ASP.NET?

I guess, what I am asking is how would Assembly Language affect the overall performance?

And does anyone code in assembly language anyway??

Thanks.



这篇关于C ++与C#对比汇编语言的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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