c - Fair comparison of code size -


i have written 2 different c implementations of algorithm runs on embedded processor (arm). fair way compare these 2 implementations in terms of code size, when downloading executable following figures:

implementation 1   .text size 55098 bytes  .data size 2048 bytes  implementation 2   .text size 54598 bytes  .data size 2048 bytes 

the difference in .text segment 500 bytes, in relative terms not lot. problem is, figure contains boot code wrapped around executable can invoked in standalone mode, ie., without operating system on embedded processor.

i wondering if has idea how actual code size of executable without bloated code.

many andrew

  1. your c compiler can produce assembly source code can examine.
  2. another possibility @ map file linker, should give sizes of individual functions.
  3. you @ binary code debugger.

to asm output or map file(s), need specify appropriate options compiler and/or linker. these options depends on tool chain (compiler, linker) use.

to asm output gcc: gcc -s -o hello_asm.s hello.c


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -