C++ vs. C# vs. Assembly Language

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • nospam

    #1

    C++ vs. C# vs. Assembly Language

    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.



  • Stefan Simek

    #2
    Re: C++ vs. C# vs. Assembly Language

    "nospam" <n@ntspam.com > wrote in message
    news:#b8eu#UkDH A.976@tk2msftng p13.phx.gbl...[color=blue]
    > Just wondering,
    >
    > What do you think the difference in performance would be between
    >
    > (1.) Compiled C#[/color]

    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.
    [color=blue]
    > (2.) Compiled C++[/color]

    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.
    [color=blue]
    > (3.) and Assembly Language[/color]

    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...
    [color=blue]
    >
    > And how would the mix be if some if any of these languages had to hit
    > against a SQL Server database[/color]

    ???
    [color=blue]
    >
    > And would the differences be more or less different is you had to use
    > ASP.NET?[/color]

    ???
    [color=blue]
    >
    > I guess, what I am asking is how would Assembly Language affect the[/color]
    overall[color=blue]
    > performance?[/color]

    ???
    [color=blue]
    >
    > And does anyone code in assembly language anyway??[/color]

    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.
    [color=blue]
    >
    > Thanks.
    >
    >
    >[/color]

    Please don't post to so many groups. By my opinion, this question belongs to
    microsoft.publi c.dotnet.framew ork.performance .

    Hope this helps,
    Stefan


    Comment

    • Chris Taylor

      #3
      Re: C++ vs. C# vs. Assembly Language

      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 microcontroller s 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:%23b8eu%23 UkDHA.976@tk2ms ftngp13.phx.gbl ...[color=blue]
      > 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[/color]
      overall[color=blue]
      > performance?
      >
      > And does anyone code in assembly language anyway??
      >
      > Thanks.
      >
      >
      >[/color]


      Comment

      • Daniel O'Connell

        #4
        Re: C++ vs. C# vs. Assembly Language


        "Stefan Simek" <simek.nospam@k ascomp.nospam.s k> wrote in message
        news:%23%23U8Cn VkDHA.1672@TK2M SFTNGP09.phx.gb l...[color=blue]
        > "nospam" <n@ntspam.com > wrote in message
        > news:#b8eu#UkDH A.976@tk2msftng p13.phx.gbl...[color=green]
        > > Just wondering,
        > >
        > > What do you think the difference in performance would be between
        > >
        > > (1.) Compiled C#[/color]
        >
        > 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.
        >[color=green]
        > > (2.) Compiled C++[/color]
        >
        > 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[/color]
        is[color=blue]
        > much the same as from C# (except for much better managed-unmanaged interop
        > capabilities and much worse code readability). Without it, it gets[/color]
        compiled[color=blue]
        > directly to native assembly code.
        >[color=green]
        > > (3.) and Assembly Language[/color]
        >
        > 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"[/color]
        and[color=blue]
        > you probably couldn't write better code than that generated by C# or other
        > compiler...
        >[color=green]
        > >
        > > And how would the mix be if some if any of these languages had to hit
        > > against a SQL Server database[/color]
        >
        > ???
        >[color=green]
        > >
        > > And would the differences be more or less different is you had to use
        > > ASP.NET?[/color]
        >
        > ???
        >[color=green]
        > >
        > > I guess, what I am asking is how would Assembly Language affect the[/color]
        > overall[color=green]
        > > performance?[/color]
        >
        > ???
        >[color=green]
        > >
        > > And does anyone code in assembly language anyway??[/color]
        >
        > 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[/color]
        ASP.NET[color=blue]
        > from it, which requires managed environment (assembler isn't and never[/color]
        could[color=blue]
        > 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
        >[/color]
        http://msdn.microsoft.com/library/de...anagedcode.asp.
        It would be possible, in theory, to access SQL server via ODBC, but it would
        be a very unpleasent experiance. You can do anything in assembly that youcan
        do in C++, if you are willing to spend a lot of time working on it.

        Generally you would only use assembly in cases where you can beat the
        compiler: rendering routines, mathmatic operations, etc. In other cases a
        good compiler will always beat a human, there just really is far to much
        information to handle.[color=blue]
        >[color=green]
        > >
        > > Thanks.
        > >
        > >
        > >[/color]
        >
        > Please don't post to so many groups. By my opinion, this question belongs[/color]
        to[color=blue]
        > microsoft.publi c.dotnet.framew ork.performance .
        >
        > Hope this helps,
        > Stefan
        >
        >[/color]


        Comment

        • Mr.Tickle

          #5
          Re: C++ vs. C# vs. Assembly Language

          As with anything, it will be dependant on the implementation.

          You gain alot more than just performance in a managed runtime.

          You cannot say A is better than B, you must put this into context and have
          identical setups and implementation to test a particular performance area.

          So I see these arguments as is unmanaged C++ better than C# as pointless,
          you need to be more specific.



          "Chris Taylor" <chris_taylor_z a@hotmail.com> wrote in message
          news:OncbrpVkDH A.2080@TK2MSFTN GP10.phx.gbl...[color=blue]
          > 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 microcontroller s etc. Though well
          > written Assembly would outperform most compiled languages, if the system[/color]
          is[color=blue]
          > 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[/color]
          object[color=blue]
          > oriented constructs.
          >
          > With regard to C# and unmanaged C++, well I think that this is really a[/color]
          case[color=blue]
          > of your preference in languages. However, in my opinion, C# will[/color]
          drastically[color=blue]
          > short-circuit your development time and help provide a more robust system.
          > The performance penalty incurred by running in a managed system is not[/color]
          that[color=blue]
          > 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,[/color]
          the[color=blue]
          > major catch with managed C++ is the fact that managed C++ is not[/color]
          verifiable[color=blue]
          > by the CLR therefore not all code is necessarily secure, while C# allows[/color]
          you[color=blue]
          > to make the decision as to whether you writing 100% safe and verifiable[/color]
          code[color=blue]
          > 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[/color]
          therefore[color=blue]
          > 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:%23b8eu%23 UkDHA.976@tk2ms ftngp13.phx.gbl ...[color=green]
          > > 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[/color]
          > overall[color=green]
          > > performance?
          > >
          > > And does anyone code in assembly language anyway??
          > >
          > > Thanks.
          > >
          > >
          > >[/color]
          >
          >[/color]


          Comment

          • Chris Taylor

            #6
            Re: C++ vs. C# vs. Assembly Language

            Hi Mr Tickle,

            Maybe I misunderstand your response here, but I do not believe that I ever
            stated A is better than B. If I did I assure you it was entirely
            unintentional. I merely tried to give a brief overview comparison of
            Assembly, IL, C#, managed and unmanaged C++. And clearly state in conclusion
            that the language chosen should be the language that suites the solution.

            Regards

            Chris Taylor

            "Mr.Tickle" <MrTickle@mrmen .com> wrote in message
            news:%234uiCEXk DHA.2456@TK2MSF TNGP09.phx.gbl. ..[color=blue]
            > As with anything, it will be dependant on the implementation.
            >
            > You gain alot more than just performance in a managed runtime.
            >
            > You cannot say A is better than B, you must put this into context and have
            > identical setups and implementation to test a particular performance area.
            >
            > So I see these arguments as is unmanaged C++ better than C# as pointless,
            > you need to be more specific.
            >
            >
            >
            > "Chris Taylor" <chris_taylor_z a@hotmail.com> wrote in message
            > news:OncbrpVkDH A.2080@TK2MSFTN GP10.phx.gbl...[color=green]
            > > 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 microcontroller s etc. Though[/color][/color]
            well[color=blue][color=green]
            > > written Assembly would outperform most compiled languages, if the system[/color]
            > is[color=green]
            > > relying on database access the database becomes the bottle neck so the
            > > Assembly code would not make much difference. Assembly would also carry[/color][/color]
            a[color=blue][color=green]
            > > sever overhead on development time due to the complexity and lack of[/color]
            > object[color=green]
            > > oriented constructs.
            > >
            > > With regard to C# and unmanaged C++, well I think that this is really a[/color]
            > case[color=green]
            > > of your preference in languages. However, in my opinion, C# will[/color]
            > drastically[color=green]
            > > short-circuit your development time and help provide a more robust[/color][/color]
            system.[color=blue][color=green]
            > > The performance penalty incurred by running in a managed system is not[/color]
            > that[color=green]
            > > significant inlight of the benefits gained from garbage collection,
            > > structured exception handling etc. On the other hand managed C++[/color][/color]
            provides[color=blue][color=green]
            > > many of the benefits of C# in terms of development time and code[/color][/color]
            security[color=blue][color=green]
            > > while still enabling you to use the C++ libraries you are used to. IMHO,[/color]
            > the[color=green]
            > > major catch with managed C++ is the fact that managed C++ is not[/color]
            > verifiable[color=green]
            > > by the CLR therefore not all code is necessarily secure, while C# allows[/color]
            > you[color=green]
            > > to make the decision as to whether you writing 100% safe and verifiable[/color]
            > code[color=green]
            > > or you are prepared to forfeited verifiability and use unsafe code.
            > >
            > > If your reference to Assembly was actually a reference to the IL code,[/color][/color]
            in[color=blue][color=green]
            > > 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[/color][/color]
            still[color=blue][color=green]
            > > giving you the benefits of object oriented code and structured exception
            > > handling etc. Once again however the IL is much more fine grained[/color]
            > therefore[color=green]
            > > 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.[/color][/color]
            And[color=blue][color=green]
            > > you should choose the language that most easily translates to the[/color][/color]
            business[color=blue][color=green]
            > > problem you are trying to solve.
            > >
            > > Hope this helps
            > >
            > > Chris Taylor
            > >
            > >
            > >
            > > "nospam" <n@ntspam.com > wrote in message
            > > news:%23b8eu%23 UkDHA.976@tk2ms ftngp13.phx.gbl ...[color=darkred]
            > > > 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[/color]
            > > overall[color=darkred]
            > > > performance?
            > > >
            > > > And does anyone code in assembly language anyway??
            > > >
            > > > Thanks.
            > > >
            > > >
            > > >[/color]
            > >
            > >[/color]
            >
            >[/color]


            Comment

            • Mr.Tickle

              #7
              Re: C++ vs. C# vs. Assembly Language

              It was to the original poster, sorry, just got in the wrong reply thing.



              "Chris Taylor" <chris_taylor_z a@hotmail.com> wrote in message
              news:OCt95WXkDH A.1656@tk2msftn gp13.phx.gbl...[color=blue]
              > Hi Mr Tickle,
              >
              > Maybe I misunderstand your response here, but I do not believe that I ever
              > stated A is better than B. If I did I assure you it was entirely
              > unintentional. I merely tried to give a brief overview comparison of
              > Assembly, IL, C#, managed and unmanaged C++. And clearly state in[/color]
              conclusion[color=blue]
              > that the language chosen should be the language that suites the solution.
              >
              > Regards
              >
              > Chris Taylor
              >
              > "Mr.Tickle" <MrTickle@mrmen .com> wrote in message
              > news:%234uiCEXk DHA.2456@TK2MSF TNGP09.phx.gbl. ..[color=green]
              > > As with anything, it will be dependant on the implementation.
              > >
              > > You gain alot more than just performance in a managed runtime.
              > >
              > > You cannot say A is better than B, you must put this into context and[/color][/color]
              have[color=blue][color=green]
              > > identical setups and implementation to test a particular performance[/color][/color]
              area.[color=blue][color=green]
              > >
              > > So I see these arguments as is unmanaged C++ better than C# as[/color][/color]
              pointless,[color=blue][color=green]
              > > you need to be more specific.
              > >
              > >
              > >
              > > "Chris Taylor" <chris_taylor_z a@hotmail.com> wrote in message
              > > news:OncbrpVkDH A.2080@TK2MSFTN GP10.phx.gbl...[color=darkred]
              > > > 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[/color][/color][/color]
              to[color=blue][color=green][color=darkred]
              > > > system level OS or embedded software for microcontroller s etc. Though[/color][/color]
              > well[color=green][color=darkred]
              > > > written Assembly would outperform most compiled languages, if the[/color][/color][/color]
              system[color=blue][color=green]
              > > is[color=darkred]
              > > > relying on database access the database becomes the bottle neck so the
              > > > Assembly code would not make much difference. Assembly would also[/color][/color][/color]
              carry[color=blue]
              > a[color=green][color=darkred]
              > > > sever overhead on development time due to the complexity and lack of[/color]
              > > object[color=darkred]
              > > > oriented constructs.
              > > >
              > > > With regard to C# and unmanaged C++, well I think that this is really[/color][/color][/color]
              a[color=blue][color=green]
              > > case[color=darkred]
              > > > of your preference in languages. However, in my opinion, C# will[/color]
              > > drastically[color=darkred]
              > > > short-circuit your development time and help provide a more robust[/color][/color]
              > system.[color=green][color=darkred]
              > > > The performance penalty incurred by running in a managed system is not[/color]
              > > that[color=darkred]
              > > > significant inlight of the benefits gained from garbage collection,
              > > > structured exception handling etc. On the other hand managed C++[/color][/color]
              > provides[color=green][color=darkred]
              > > > many of the benefits of C# in terms of development time and code[/color][/color]
              > security[color=green][color=darkred]
              > > > while still enabling you to use the C++ libraries you are used to.[/color][/color][/color]
              IMHO,[color=blue][color=green]
              > > the[color=darkred]
              > > > major catch with managed C++ is the fact that managed C++ is not[/color]
              > > verifiable[color=darkred]
              > > > by the CLR therefore not all code is necessarily secure, while C#[/color][/color][/color]
              allows[color=blue][color=green]
              > > you[color=darkred]
              > > > to make the decision as to whether you writing 100% safe and[/color][/color][/color]
              verifiable[color=blue][color=green]
              > > code[color=darkred]
              > > > or you are prepared to forfeited verifiability and use unsafe code.
              > > >
              > > > If your reference to Assembly was actually a reference to the IL code,[/color][/color]
              > in[color=green][color=darkred]
              > > > that case I believe that it is quite feasible to generate a[/color][/color][/color]
              application[color=blue][color=green][color=darkred]
              > > > using IL. IL would allow you to make use of features that are yet to[/color][/color][/color]
              be[color=blue][color=green][color=darkred]
              > > > exposed by some of the higher level .NET languages such as C#, while[/color][/color]
              > still[color=green][color=darkred]
              > > > giving you the benefits of object oriented code and structured[/color][/color][/color]
              exception[color=blue][color=green][color=darkred]
              > > > handling etc. Once again however the IL is much more fine grained[/color]
              > > therefore[color=darkred]
              > > > increasing the physical amount of code you will be typing and it is[/color][/color][/color]
              less[color=blue][color=green][color=darkred]
              > > > 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.[/color][/color]
              > And[color=green][color=darkred]
              > > > you should choose the language that most easily translates to the[/color][/color]
              > business[color=green][color=darkred]
              > > > problem you are trying to solve.
              > > >
              > > > Hope this helps
              > > >
              > > > Chris Taylor
              > > >
              > > >
              > > >
              > > > "nospam" <n@ntspam.com > wrote in message
              > > > news:%23b8eu%23 UkDHA.976@tk2ms ftngp13.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[/color][/color][/color]
              hit[color=blue][color=green][color=darkred]
              > > > > against a SQL Server database
              > > > >
              > > > > And would the differences be more or less different is you had to[/color][/color][/color]
              use[color=blue][color=green][color=darkred]
              > > > > 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.
              > > > >
              > > > >
              > > > >
              > > >
              > > >[/color]
              > >
              > >[/color]
              >
              >[/color]


              Comment

              • Chris Taylor

                #8
                Re: C++ vs. C# vs. Assembly Language

                After I posted I realized that might be what happened. I apologize for the
                hastiness of my post!

                Regards

                Chris Taylor

                "Mr.Tickle" <MrTickle@mrmen .com> wrote in message
                news:eTBtdZXkDH A.3312@tk2msftn gp13.phx.gbl...[color=blue]
                > It was to the original poster, sorry, just got in the wrong reply thing.
                >
                >
                >
                > "Chris Taylor" <chris_taylor_z a@hotmail.com> wrote in message
                > news:OCt95WXkDH A.1656@tk2msftn gp13.phx.gbl...[color=green]
                > > Hi Mr Tickle,
                > >
                > > Maybe I misunderstand your response here, but I do not believe that I[/color][/color]
                ever[color=blue][color=green]
                > > stated A is better than B. If I did I assure you it was entirely
                > > unintentional. I merely tried to give a brief overview comparison of
                > > Assembly, IL, C#, managed and unmanaged C++. And clearly state in[/color]
                > conclusion[color=green]
                > > that the language chosen should be the language that suites the[/color][/color]
                solution.[color=blue][color=green]
                > >
                > > Regards
                > >
                > > Chris Taylor
                > >
                > > "Mr.Tickle" <MrTickle@mrmen .com> wrote in message
                > > news:%234uiCEXk DHA.2456@TK2MSF TNGP09.phx.gbl. ..[color=darkred]
                > > > As with anything, it will be dependant on the implementation.
                > > >
                > > > You gain alot more than just performance in a managed runtime.
                > > >
                > > > You cannot say A is better than B, you must put this into context and[/color][/color]
                > have[color=green][color=darkred]
                > > > identical setups and implementation to test a particular performance[/color][/color]
                > area.[color=green][color=darkred]
                > > >
                > > > So I see these arguments as is unmanaged C++ better than C# as[/color][/color]
                > pointless,[color=green][color=darkred]
                > > > you need to be more specific.
                > > >
                > > >
                > > >
                > > > "Chris Taylor" <chris_taylor_z a@hotmail.com> wrote in message
                > > > news:OncbrpVkDH A.2080@TK2MSFTN GP10.phx.gbl...
                > > > > Hi,
                > > > >
                > > > > Assembly language in the form of x86 assembly would seldom be used[/color][/color][/color]
                to[color=blue][color=green][color=darkred]
                > > > > develop a desktop or distributed type application, it is more suited[/color][/color]
                > to[color=green][color=darkred]
                > > > > system level OS or embedded software for microcontroller s etc.[/color][/color][/color]
                Though[color=blue][color=green]
                > > well[color=darkred]
                > > > > written Assembly would outperform most compiled languages, if the[/color][/color]
                > system[color=green][color=darkred]
                > > > is
                > > > > relying on database access the database becomes the bottle neck so[/color][/color][/color]
                the[color=blue][color=green][color=darkred]
                > > > > Assembly code would not make much difference. Assembly would also[/color][/color]
                > carry[color=green]
                > > a[color=darkred]
                > > > > 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[/color][/color][/color]
                really[color=blue]
                > a[color=green][color=darkred]
                > > > case
                > > > > of your preference in languages. However, in my opinion, C# will
                > > > drastically
                > > > > short-circuit your development time and help provide a more robust[/color]
                > > system.[color=darkred]
                > > > > The performance penalty incurred by running in a managed system is[/color][/color][/color]
                not[color=blue][color=green][color=darkred]
                > > > that
                > > > > significant inlight of the benefits gained from garbage collection,
                > > > > structured exception handling etc. On the other hand managed C++[/color]
                > > provides[color=darkred]
                > > > > many of the benefits of C# in terms of development time and code[/color]
                > > security[color=darkred]
                > > > > while still enabling you to use the C++ libraries you are used to.[/color][/color]
                > IMHO,[color=green][color=darkred]
                > > > 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#[/color][/color]
                > allows[color=green][color=darkred]
                > > > you
                > > > > to make the decision as to whether you writing 100% safe and[/color][/color]
                > verifiable[color=green][color=darkred]
                > > > code
                > > > > or you are prepared to forfeited verifiability and use unsafe code.
                > > > >
                > > > > If your reference to Assembly was actually a reference to the IL[/color][/color][/color]
                code,[color=blue][color=green]
                > > in[color=darkred]
                > > > > that case I believe that it is quite feasible to generate a[/color][/color]
                > application[color=green][color=darkred]
                > > > > using IL. IL would allow you to make use of features that are yet to[/color][/color]
                > be[color=green][color=darkred]
                > > > > exposed by some of the higher level .NET languages such as C#, while[/color]
                > > still[color=darkred]
                > > > > giving you the benefits of object oriented code and structured[/color][/color]
                > exception[color=green][color=darkred]
                > > > > 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[/color][/color]
                > less[color=green][color=darkred]
                > > > > 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[/color][/color][/color]
                design.[color=blue][color=green]
                > > And[color=darkred]
                > > > > you should choose the language that most easily translates to the[/color]
                > > business[color=darkred]
                > > > > problem you are trying to solve.
                > > > >
                > > > > Hope this helps
                > > > >
                > > > > Chris Taylor
                > > > >
                > > > >
                > > > >
                > > > > "nospam" <n@ntspam.com > wrote in message
                > > > > news:%23b8eu%23 UkDHA.976@tk2ms ftngp13.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[/color][/color]
                > hit[color=green][color=darkred]
                > > > > > against a SQL Server database
                > > > > >
                > > > > > And would the differences be more or less different is you had to[/color][/color]
                > use[color=green][color=darkred]
                > > > > > ASP.NET?
                > > > > >
                > > > > > I guess, what I am asking is how would Assembly Language affect[/color][/color][/color]
                the[color=blue][color=green][color=darkred]
                > > > > overall
                > > > > > performance?
                > > > > >
                > > > > > And does anyone code in assembly language anyway??
                > > > > >
                > > > > > Thanks.
                > > > > >
                > > > > >
                > > > > >
                > > > >
                > > > >
                > > >
                > > >[/color]
                > >
                > >[/color]
                >
                >[/color]


                Comment

                • nospam

                  #9
                  Re: C++ vs. C# vs. Assembly Language

                  Ok, let's say there was this Mr. Perfect Coder who could type 1000 words per
                  minute and not make a single mistake.

                  What would the performance be of Assembly Language against C# and C++?
                  2 time faster, 4 times faster, 10 times faster?
                  Would it be fair to say that like 20% of the code make up 80% of the
                  execution time?


                  And since the Database would be a possible bottle neck in an ASP.NET
                  application, say for instance a shopping cart, could assembly language be
                  used in some form or another or somewhere to help the overall speed of the
                  web site in processing web based orders?

                  Thanks.






                  "Chris Taylor" <chris_taylor_z a@hotmail.com> wrote in message
                  news:OncbrpVkDH A.2080@TK2MSFTN GP10.phx.gbl...[color=blue]
                  > 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 microcontroller s etc. Though well
                  > written Assembly would outperform most compiled languages, if the system[/color]
                  is[color=blue]
                  > 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[/color]
                  object[color=blue]
                  > oriented constructs.
                  >
                  > With regard to C# and unmanaged C++, well I think that this is really a[/color]
                  case[color=blue]
                  > of your preference in languages. However, in my opinion, C# will[/color]
                  drastically[color=blue]
                  > short-circuit your development time and help provide a more robust system.
                  > The performance penalty incurred by running in a managed system is not[/color]
                  that[color=blue]
                  > 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,[/color]
                  the[color=blue]
                  > major catch with managed C++ is the fact that managed C++ is not[/color]
                  verifiable[color=blue]
                  > by the CLR therefore not all code is necessarily secure, while C# allows[/color]
                  you[color=blue]
                  > to make the decision as to whether you writing 100% safe and verifiable[/color]
                  code[color=blue]
                  > 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[/color]
                  therefore[color=blue]
                  > 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:%23b8eu%23 UkDHA.976@tk2ms ftngp13.phx.gbl ...[color=green]
                  > > 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[/color]
                  > overall[color=green]
                  > > performance?
                  > >
                  > > And does anyone code in assembly language anyway??
                  > >
                  > > Thanks.
                  > >
                  > >
                  > >[/color]
                  >
                  >[/color]


                  Comment

                  • Cowboy \(Gregory A. Beamer\)

                    #10
                    Re: C++ vs. C# vs. Assembly Language

                    Assembly language would win, followed by compiled C++ for windows (COM),
                    followed by .NET. The C++ in .NET works a bit better with some algorythms,
                    while C# works better with some.

                    Performance is not the sole matrix in development, however. When you
                    consistently error on the side of performance, you often end up with a
                    solution that is less maintainable, which is generally more costly.

                    --
                    Gregory A. Beamer
                    MVP; MCP: +I, SE, SD, DBA

                    *************** *************** *************** *************** **********
                    Think Outside the Box!
                    *************** *************** *************** *************** **********
                    "nospam" <n@ntspam.com > wrote in message
                    news:%23b8eu%23 UkDHA.976@tk2ms ftngp13.phx.gbl ...[color=blue]
                    > 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[/color]
                    overall[color=blue]
                    > performance?
                    >
                    > And does anyone code in assembly language anyway??
                    >
                    > Thanks.
                    >
                    >
                    >[/color]


                    Comment

                    • Keith Patrick

                      #11
                      Re: C++ vs. C# vs. Assembly Language

                      I think it's also reasonable to imagine in the not-too-distant future that
                      unmanaged applications will not even be allowed to run under Windows except
                      in a compatibility sandbox of some kind, so ultimately, security wins out
                      over performance.


                      Comment

                      • Chris Taylor

                        #12
                        Re: C++ vs. C# vs. Assembly Language

                        Disclaimer: I am going out on a limb here so please be kind. :)

                        What you are asking is not easily quantifiable for the arbitrary case. But
                        lets take a concrete example of a Bresenham line drawing routine. Assuming
                        your Mr. Perfect coder is equally proficient and has expert skills in
                        Assembly, C++ and C#, the Assembly implementation would definately out
                        perform the C++ routine, which inturn out perform a corresponding C#
                        routine. This would be the case for any CPU intesive routine such as a JPEG
                        or MPEG encoder/decoder. The performance difference would be dependent on
                        the processor, however I believe even an expert Assembly programmer would
                        require multiple itterations to fully optimize the routine that therefore
                        requiring much more development time to complete the task, most likely the
                        initial Assembly version would only be slightly better than the C++ version.
                        The Assembly version will not only be faster it will most likely also
                        require less memory.

                        The example I have given here are for a routine that is possible executed
                        1000's, 100000's even 1000000's times per second so the difference of a few
                        clock cycles really makes a difference. However when accessing a database I
                        believe if the code is written by Mr. Perfect coder the DB access is going
                        to be the bottle neck so a few clock cycles on the processing would not make
                        much difference. I doubt it is possible to access a normal relational
                        database millions of times per second so the cycles in code do not make a
                        real diffence when networks and harddisks are in the equation. However if
                        you are reading data from a database and then doing a FFT on the data once
                        again the focus has shifted to the CPU intesive task and Assembly might be
                        the most performant implementation however a FFT in Assembly is a real
                        nightmare and I believe could be more than triple the development time of a
                        C++ implementation. However this would not warrent using Assembler to access
                        the data from the database, since ultimately you would be making a call to a
                        API function from dblib or OCI which whether you call it from C++, C# or
                        Assembly it is not going to execute any faster.

                        Use the right tool for the job.

                        CPU intensive tasks requiring highest possible throughput -> Assembly
                        Constrained Memory such as PICKs or AVRs -> Assembly
                        Low level kernel mode drivers ->
                        Assembly/C
                        Portable efficient source code with performance as priority -> C/C++
                        Secure robust
                        -> C#
                        Most other types of
                        -> C++/C#

                        With C# and C++ having the highest level of maintainability . OK, what ever I
                        have neglected to say I am sure others will fill in.

                        Hope this helps, if not try give a concrete example of what you want to do
                        and maybe someone can give you a more exact answer.

                        Chris Taylor

                        "nospam" <n@ntspam.com > wrote in message
                        news:%23uILdIZk DHA.2432@TK2MSF TNGP10.phx.gbl. ..[color=blue]
                        > Ok, let's say there was this Mr. Perfect Coder who could type 1000 words[/color]
                        per[color=blue]
                        > minute and not make a single mistake.
                        >
                        > What would the performance be of Assembly Language against C# and C++?
                        > 2 time faster, 4 times faster, 10 times faster?
                        > Would it be fair to say that like 20% of the code make up 80% of the
                        > execution time?
                        >
                        >
                        > And since the Database would be a possible bottle neck in an ASP.NET
                        > application, say for instance a shopping cart, could assembly language be
                        > used in some form or another or somewhere to help the overall speed of the
                        > web site in processing web based orders?
                        >
                        > Thanks.
                        >
                        >
                        >
                        >
                        >
                        >
                        > "Chris Taylor" <chris_taylor_z a@hotmail.com> wrote in message
                        > news:OncbrpVkDH A.2080@TK2MSFTN GP10.phx.gbl...[color=green]
                        > > 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 microcontroller s etc. Though[/color][/color]
                        well[color=blue][color=green]
                        > > written Assembly would outperform most compiled languages, if the system[/color]
                        > is[color=green]
                        > > relying on database access the database becomes the bottle neck so the
                        > > Assembly code would not make much difference. Assembly would also carry[/color][/color]
                        a[color=blue][color=green]
                        > > sever overhead on development time due to the complexity and lack of[/color]
                        > object[color=green]
                        > > oriented constructs.
                        > >
                        > > With regard to C# and unmanaged C++, well I think that this is really a[/color]
                        > case[color=green]
                        > > of your preference in languages. However, in my opinion, C# will[/color]
                        > drastically[color=green]
                        > > short-circuit your development time and help provide a more robust[/color][/color]
                        system.[color=blue][color=green]
                        > > The performance penalty incurred by running in a managed system is not[/color]
                        > that[color=green]
                        > > significant inlight of the benefits gained from garbage collection,
                        > > structured exception handling etc. On the other hand managed C++[/color][/color]
                        provides[color=blue][color=green]
                        > > many of the benefits of C# in terms of development time and code[/color][/color]
                        security[color=blue][color=green]
                        > > while still enabling you to use the C++ libraries you are used to. IMHO,[/color]
                        > the[color=green]
                        > > major catch with managed C++ is the fact that managed C++ is not[/color]
                        > verifiable[color=green]
                        > > by the CLR therefore not all code is necessarily secure, while C# allows[/color]
                        > you[color=green]
                        > > to make the decision as to whether you writing 100% safe and verifiable[/color]
                        > code[color=green]
                        > > or you are prepared to forfeited verifiability and use unsafe code.
                        > >
                        > > If your reference to Assembly was actually a reference to the IL code,[/color][/color]
                        in[color=blue][color=green]
                        > > 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[/color][/color]
                        still[color=blue][color=green]
                        > > giving you the benefits of object oriented code and structured exception
                        > > handling etc. Once again however the IL is much more fine grained[/color]
                        > therefore[color=green]
                        > > 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.[/color][/color]
                        And[color=blue][color=green]
                        > > you should choose the language that most easily translates to the[/color][/color]
                        business[color=blue][color=green]
                        > > problem you are trying to solve.
                        > >
                        > > Hope this helps
                        > >
                        > > Chris Taylor
                        > >
                        > >
                        > >
                        > > "nospam" <n@ntspam.com > wrote in message
                        > > news:%23b8eu%23 UkDHA.976@tk2ms ftngp13.phx.gbl ...[color=darkred]
                        > > > 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[/color]
                        > > overall[color=darkred]
                        > > > performance?
                        > > >
                        > > > And does anyone code in assembly language anyway??
                        > > >
                        > > > Thanks.
                        > > >
                        > > >
                        > > >[/color]
                        > >
                        > >[/color]
                        >
                        >[/color]


                        Comment

                        • keyur shah

                          #13
                          Re: C++ vs. C# vs. Assembly Language

                          Hi,

                          I used to work with Assembly language, and definitely the code written
                          in Assembly works much faster and is more compact than that generated by
                          any High Level Languages, or thru code generated by CLR for MSIL.

                          So, Assembly is best as far as performance goes. But, yes it doesnt have
                          that flexibility that you enjoy with the tools that helps you code,
                          trace, debug, finetune the applications.

                          Today is the world of faster processors, more memory, and sophisticated
                          tools.

                          Hope this information helps.

                          Keyur Shah
                          Verizon Communications


                          *** Sent via Developersdex http://www.developersdex.com ***
                          Don't just participate in USENET...get rewarded for it!

                          Comment

                          • nospam

                            #14
                            Re: C++ vs. C# vs. Assembly Language

                            Did you ever use Assembly to help you in speeding up your database access?



                            "keyur shah" <keyur@software klinic.com> wrote in message
                            news:u45pp4ckDH A.372@TK2MSFTNG P11.phx.gbl...[color=blue]
                            > Hi,
                            >
                            > I used to work with Assembly language, and definitely the code written
                            > in Assembly works much faster and is more compact than that generated by
                            > any High Level Languages, or thru code generated by CLR for MSIL.
                            >
                            > So, Assembly is best as far as performance goes. But, yes it doesnt have
                            > that flexibility that you enjoy with the tools that helps you code,
                            > trace, debug, finetune the applications.
                            >
                            > Today is the world of faster processors, more memory, and sophisticated
                            > tools.
                            >
                            > Hope this information helps.
                            >
                            > Keyur Shah
                            > Verizon Communications
                            >
                            >
                            > *** Sent via Developersdex http://www.developersdex.com ***
                            > Don't just participate in USENET...get rewarded for it![/color]


                            Comment

                            • Jeff Louie

                              #15
                              Re: C++ vs. C# vs. Assembly Language

                              At some point I have done all three, but just the thought of coding a
                              GUI database app in assembly makes me nauseated :) C++ COM is fast, but
                              not for everyone. C# is going to more reliable and easier to maintain.
                              That said, a lot of database applications are written using drag and
                              drop 3GL.

                              Regards,
                              Jeff[color=blue]
                              >And does anyone code in assembly language anyway??<[/color]

                              *** Sent via Developersdex http://www.developersdex.com ***
                              Don't just participate in USENET...get rewarded for it!

                              Comment

                              Working...