C++ vs. C# vs. Assembly Language

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

    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.



  • Chris Taylor

    #2
    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

    • Mr.Tickle

      #3
      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

        #4
        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

          #5
          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

            #6
            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

              #7
              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\)

                #8
                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

                  #9
                  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

                    #10
                    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

                    • warren

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

                      If so, MS will rather make their .net framework sit at the most bottom level
                      and get out of the win32 api totally. wouldn't that be even faster for the
                      managed applications?

                      btw, is Longhorn built in this fashion? LOL.


                      "Keith Patrick" <richard_keith_ patrick@hotmail .com> wrote in message
                      news:eHZsdAakDH A.2500@TK2MSFTN GP10.phx.gbl...[color=blue]
                      > 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[/color]
                      except[color=blue]
                      > in a compatibility sandbox of some kind, so ultimately, security wins out
                      > over performance.
                      >
                      >[/color]


                      Comment

                      • Will Clark

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

                        Imagine that! And that goes onto a situation where viruses would have to be
                        digitally signed before they did any damage to your computer...

                        I can't wait :o)


                        "Keith Patrick" <richard_keith_ patrick@hotmail .com> wrote in message
                        news:eHZsdAakDH A.2500@TK2MSFTN GP10.phx.gbl...[color=blue]
                        > 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[/color]
                        except[color=blue]
                        > in a compatibility sandbox of some kind, so ultimately, security wins out
                        > over performance.
                        >
                        >[/color]


                        Comment

                        • Jonathan Hodges

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

                          This may be speculation but here it is anyway...

                          ITProToday.com is a leading online source of news, analysis and how-to's about the information technology industry.


                          Q: So what's changing from a developer's standpoint?
                          A: In the technology generations leading up to Longhorn, Microsoft has been
                          moving to a .NET-based managed code environment, and the Longhorn generation
                          will finally mark a clean split with the Win32 APIs of the past. That is,
                          Win32 will be in maintenance mode, and all new development will occur with
                          managed .NET APIs. One such API, Avalon, forms the basis for the new Desktop
                          Compositing Engine (DCE) in Longhorn that replaces GDI and GDI+. Another,
                          called Aero, provides APIs for the new user interface. All of the new
                          Longhorn APIs will utilize the XML Application markup language (XAML) to
                          make Longhorn more accessible to developers than ever before. The idea is to
                          significantly reduce the number of APIs and make the APIs more standardized.
                          Today, there are over 76,000 Win32 APIs, and countless wrappers. With
                          Longhorn, Microsoft hopes to reduce the API set to 8,000 to 10,000.

                          Another significant change in Longhorn involves device drivers. In the past,
                          Microsoft allowed customers to use non-signed drivers, which helped
                          compatibility, but caused stability problems. No more: In Longhorn, users
                          hoping to take advantage of the system's exciting new capabilities will only
                          be able to use signed drivers.

                          Developers interested in Longhorn should examine the Visual Studio .NET
                          "Whidbey" release, currently in beta, which includes a XAML visual designer.
                          In October, at the PDC in Los Angelese, Microsoft will provide developers
                          with the first public release of its Longhorn Software Developer Kit (SDK),
                          which will include developer-accessible UI components and behaviors.


                          "Keith Patrick" <richard_keith_ patrick@hotmail .com> wrote in message
                          news:eHZsdAakDH A.2500@TK2MSFTN GP10.phx.gbl...[color=blue]
                          > 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[/color]
                          except[color=blue]
                          > in a compatibility sandbox of some kind, so ultimately, security wins out
                          > over performance.
                          >
                          >[/color]


                          Comment

                          • Jason Smith

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

                            Back to the original question:

                            Think of C as a high level compiler. Using pointer arithmetic, you can get
                            very close to the speed of optimized Assembler code just using C.

                            Notice I said "optimized. " The C compiler does literally hundreds of
                            mechanical optimizations. Some of these optimizations are to keep the
                            pipeline full in a particular CPU architecture. Loops are unrolled.
                            Methods are inlined. It is very complex, and it takes an expert to come
                            anywhere near close to the speed of C using Assembly language. The general
                            rule is, if you can read it, it isn't optimized.

                            C++ is an OO extension of C, sort of. When you add OO, you add virtual
                            tables to functions, memory management overhead, etc. Things you need for
                            more high level programming. This slows things down somewhat. Still, if
                            you were to create the same constructs in Assembler, you couldn't do any
                            better. OO is there to help people deal with complexity. Assembler adds
                            tremendous complexity to even the simplest of tasks.

                            Because Assembler is so difficult to optimize by hand, and because it makes
                            things more complex, almost anything you write in assembler is going to be
                            SLOWER than the equivalent C++, unless you are maybe using it to optimize
                            one tiny portion of your program, or unless you are working without any
                            budget and time constraints.

                            Now to C#.

                            C# is a compiled language. The compiler is a JIT compiler, so it doesn't do
                            all the optimizations that a C++ optimizing compiler can. There just isn't
                            time. But it does a pretty darn good job. If you are using "safe" code,
                            that will limit your overall speed. However, if you can use unsafe code,
                            pointer arithmetic in particular, you'll find that C# is blazingly fast.

                            Some numbers:

                            I've been playing around with a program for solving the Rubik's Cube using
                            brute force. I wrote it in Java, C# using safe code, and C# using pointers,
                            each one faster than the last.

                            C# using pointers: 6x
                            C# using safe code: 3x
                            Java (Sun 1.4) using code optimized for speed: 1x

                            I haven't written it in C/C++, but seeing how much faster it is than Sun
                            Java for this particular task, I have to think it is getting in the same
                            ballpark.

                            "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

                            • Jon Skeet [C# MVP]

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

                              Jason Smith <jason@nospam.c om> wrote:[color=blue]
                              > Some numbers:
                              >
                              > I've been playing around with a program for solving the Rubik's Cube using
                              > brute force. I wrote it in Java, C# using safe code, and C# using pointers,
                              > each one faster than the last.
                              >
                              > C# using pointers: 6x
                              > C# using safe code: 3x
                              > Java (Sun 1.4) using code optimized for speed: 1x
                              >
                              > I haven't written it in C/C++, but seeing how much faster it is than Sun
                              > Java for this particular task, I have to think it is getting in the same
                              > ballpark.[/color]

                              I'd be interested to see the code you're using there - C# and Java are
                              roughly the same speed in tests I've done. C# certainly isn't 3 times
                              as fast "in general".

                              --
                              Jon Skeet - <skeet@pobox.co m>
                              Pobox has been discontinued as a separate service, and all existing customers moved to the Fastmail platform.

                              If replying to the group, please do not mail me too

                              Comment

                              Working...