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
- your c compiler can produce assembly source code can examine.
- another possibility @ map file linker, should give sizes of individual functions.
- 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
Post a Comment