470,833 Members | 1,203 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,833 developers. It's quick & easy.

c to asm source lines ratio

ca1
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
Jun 27 '08 #1
3 1590
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.

Jun 27 '08 #2
In article <91**********************************@m36g2000hse. googlegroups.com>,
ca1 <xc*********@gmail.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
Jun 27 '08 #3
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
Jun 27 '08 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Colin McKinnon | last post: by
7 posts views Thread by eric | last post: by
4 posts views Thread by xixi | last post: by
7 posts views Thread by David Given | last post: by
82 posts views Thread by Edward Elliott | last post: by
3 posts views Thread by Danny Ni | last post: by
reply views Thread by mihailmihai484 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.