Efficient 'C' Programming and its Effect on the Performance of Embedded Systems
Improving embedded MCU performance with more efficient incremental C-coding
By Eric Shufro, Department of Computer Science and Engineering Florida Atlantic University
Embedded.com (06/22/10, 05:08:00 PM EDT)
Efficient coding has been an important subject for years especially for resource constrained systems running real-time applications.
Most people take compiler optimizations for granted and do not realize the effect of efficient ‘C’ programming on program execution time. The examples described in this article are intended to serve as a reminder and testament to the fact that program execution speed mainly relies on efficient programming practices
To exemplify the notion consider writing a multiplication subroutine for a processor that does not have a hardware multiplier. Using simple repetitive addition algorithm, the loop will take the multiplicand and adds to itself n times, where n is the multiplier. Think of the run time of 5x1000=5000, versus a 1000x5=5000. A smarter loop would take the smaller number as the multiplier and the larger as the multiplicand.
In this article I have implemented small incremental code improvements to an embedded Ethernet driver, and proved that a performance gain of nearly 17% has been achieved. This figure does not account for the effect of additional compiler optimizations or TCP windowing improvements.
E-mail This Article | Printer-Friendly Page |
Related Articles
- Automating C test cases for embedded system verification
- Is Tomorrow's Embedded-Systems Programming Language Still C?
- Embedded Systems: Programmable Logic -> Programmable system chips 'fly' high
- Embedded Systems: Programmable Logic -> Programming enters designer's core
- Leveraging the RISC-V Efficient Trace (E-Trace) standard
New Articles
- Quantum Readiness Considerations for Suppliers and Manufacturers
- A Rad Hard ASIC Design Approach: Triple Modular Redundancy (TMR)
- Early Interactive Short Isolation for Faster SoC Verification
- The Ideal Crypto Coprocessor with Root of Trust to Support Customer Complete Full Chip Evaluation: PUFcc gained SESIP and PSA Certified™ Level 3 RoT Component Certification
- Advanced Packaging and Chiplets Can Be for Everyone
Most Popular
- System Verilog Assertions Simplified
- System Verilog Macro: A Powerful Feature for Design Verification Projects
- UPF Constraint coding for SoC - A Case Study
- Dynamic Memory Allocation and Fragmentation in C and C++
- Enhancing VLSI Design Efficiency: Tackling Congestion and Shorts with Practical Approaches and PnR Tool (ICC2)