Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > c to asm source lines ratio

Reply
Thread Tools

c to asm source lines ratio

 
 
ca1
Guest
Posts: n/a
 
      05-28-2008
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
 
Reply With Quote
 
 
 
 
santosh
Guest
Posts: n/a
 
      05-28-2008
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.

 
Reply With Quote
 
 
 
 
Walter Roberson
Guest
Posts: n/a
 
      05-28-2008
In article <(E-Mail Removed)>,
ca1 <(E-Mail Removed)> 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.


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
 
Reply With Quote
 
Walter Banks
Guest
Posts: n/a
 
      05-28-2008
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


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to know two lines are a pare parallel lines lovecreatesbeauty C Programming 11 04-28-2006 03:32 AM
How to display a string in many lines, each lines have a specified length thuyptt@dsp.com.vn C++ 1 12-06-2005 07:26 AM
Asp.Net Calender, how to display 5 lines if there are only 5 lines in one month? Jack ASP .Net 9 10-12-2005 03:44 AM
Modems, Analog Lines and ... Electrical Lines? Sens Fan Happy In Ohio Computer Support 5 09-02-2004 04:15 AM
Re: how to read 10 lines from a 200 lines file and write to a new file?? Joe Wright C Programming 0 07-27-2003 08:50 PM



Advertisments