c to asm source lines ratio

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

    c to asm source lines ratio

    i wonder how much it might be.
    my guess is 4 for average short function about 20 lines x 80
    characters.
    i know it is very difficult to come up with some "average c code" and
    "average asm code" .... nevertheless someone might have some
    experience.
    - thanks
  • santosh

    #2
    Re: c to asm source lines ratio

    ca1 wrote:
    i wonder how much it might be.
    my guess is 4 for average short function about 20 lines x 80
    characters.
    i know it is very difficult to come up with some "average c code" and
    "average asm code" .... nevertheless someone might have some
    experience.
    - thanks
    The answer would be different for different pieces of code and for CISC
    vs. RISC architectures. Generally the assembler equivalent of a segment
    of C code tends to be several times as long in terms of lines. Some
    assembler dialects can have multiple instruction mnemonics in a single
    line and of course C code can be written in wide ranging manner with
    regard to vertical space. Compiler optimisation can dramatically affect
    this ratio to IME.

    Comment

    • Walter Roberson

      #3
      Re: c to asm source lines ratio

      In article <91fd63cd-5556-41d0-b4c5-e72781773b9f@m3 6g2000hse.googl egroups.com>,
      ca1 <xchmelmilos@gm ail.comwrote:
      >i wonder how much it might be.
      >my guess is 4 for average short function about 20 lines x 80
      >characters.
      >i know it is very difficult to come up with some "average c code" and
      >"average asm code" .... nevertheless someone might have some
      >experience.
      Completely unscientific experiment with a small number of small programs:
      about 6 2/3.

      --
      "Do not on any account attempt to write on both sides of
      the paper at once." -- Walter C. Sellar

      Comment

      • Walter Banks

        #4
        Re: c to asm source lines ratio

        It is not a reliable metric. We have examples where several lines
        of source yields one instruction and the converse is also true.

        w..


        ca1 wrote:
        i wonder how much it might be.
        my guess is 4 for average short function about 20 lines x 80
        characters.
        i know it is very difficult to come up with some "average c code" and
        "average asm code" .... nevertheless someone might have some
        experience.
        - thanks

        Comment

        Working...