c to asm source lines ratio

C

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
 
S

santosh

ca1 said:
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.
 
W

Walter Roberson

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.
 
W

Walter Banks

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

w..
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top