<< Chapter < Page Chapter >> Page >

Library routines

If the algorithm uses common mathematical operations, such as the cosine and FFT operations, it is usuallywise to use existing library routines instead of "reinventing the wheel." As many library routines are readily available from DSPmanufacturers and over the internet, the first factor to consider in using a library is its license: do you have permission to use it inyour application? Libraries can often be used freely for educational and research purposes, but any other use requires inspectionof the library license.

The second factor to consider is the design goal of the library: was it designed for speed or low memory usage? Typically speed can bebought with more memory and vice-versa, so when selecting a library it is important to decidewhich budget (speed or memory) is more important with respect to the routine.

Compiler optimization

Recall that the basic operation of a C compiler is to translate C source code into assembly instructions and then into an executable.

"Compiler optimization is used to improve the efficiency (in terms ofrunning time or resource usage) of the executables output by a compiler. These techniques allow programmers to write source code in a straightforward manner, expressing their intentions clearly,while allowing the computer to make choices about implementation details that lead to efficient execution. Contrary to what the termmight imply, this rarely results in executables that are perfectly "optimal" by any measure, only executables that are much improvedcompared to direct translation of the programmer's original source."

An optimizing compiler traditionally groups optimizations into phases . Each phase contains a series of optimizations (or transformations) that are performed in a fixed order.These phases are usually turned on with command-line flags such as -O1 , -O2 , etc. Each flag indicates an optimization "level" where the level includes all of the lower levels. At higheroptimization levels bugs in the code are sometimes introduced, so it is important to check the behavior of a compiler-optimized programagainst the reference implementation. Keep the highest optimization level that produces accurate code.

At this point the compiled code should be checked against the budgetary constraints. Is it fast enough? Does it fit in available memory?Total memory usage is placed in a file produced by the compiler (sometimes a command-line flag is needed for this). Speed can bemeasured in a couple of ways. The most common method is the use of a profiler . A profiler tracks the performance of the program, providing data on how many times each function is called, as well ashow much time each function takes in terms of cycles and percentages of total program cycles. A simulator also allows clock cycles to bemeasured, typically by allowing the user to place breakpoints around sections of code to be measured. If the speed and memory properties ofthe compiled code fit the budget, optimization is finished. If not, some of the routines must be hand-written in assembly.

Write key assembly routines manually

Finally, if the budget cannot be met with the other optimization techniques some routines must be written in assembly. Manually-writtenassembly code is usually the most efficient, but it is labor-intensive and it is not portable to other architectures.Therefore it is done as a last resort and only on routines that absolutely require it for budget constraints to be met. This is doneby rewriting the routine that consumes the largest portion of the budget, followed by the next largest budget-consuming routine and soon until the budget is met. It should be noted that this step is almost always required in embedded applications ascurrent state-of-the-art C compilers and optimizers do not produce sufficiently fast and/or small code.

If meeting the budget is unexpectedly difficult, remember that no compiler optimization or assembler can effectively overcome a poor algorithm design or implementation. If you are confident that your implentation is fast and accurate, then the budget may be too tight for the application. Either some parts ofthe application must be removed (extra "features", for example) or an architecture with more resources must be used.

Questions & Answers

differentiate between demand and supply giving examples
Lambiv Reply
differentiated between demand and supply using examples
Lambiv
what is labour ?
Lambiv
how will I do?
Venny Reply
how is the graph works?I don't fully understand
Rezat Reply
information
Eliyee
devaluation
Eliyee
t
WARKISA
hi guys good evening to all
Lambiv
multiple choice question
Aster Reply
appreciation
Eliyee
explain perfect market
Lindiwe Reply
In economics, a perfect market refers to a theoretical construct where all participants have perfect information, goods are homogenous, there are no barriers to entry or exit, and prices are determined solely by supply and demand. It's an idealized model used for analysis,
Ezea
What is ceteris paribus?
Shukri Reply
other things being equal
AI-Robot
When MP₁ becomes negative, TP start to decline. Extuples Suppose that the short-run production function of certain cut-flower firm is given by: Q=4KL-0.6K2 - 0.112 • Where is quantity of cut flower produced, I is labour input and K is fixed capital input (K-5). Determine the average product of lab
Kelo
Extuples Suppose that the short-run production function of certain cut-flower firm is given by: Q=4KL-0.6K2 - 0.112 • Where is quantity of cut flower produced, I is labour input and K is fixed capital input (K-5). Determine the average product of labour (APL) and marginal product of labour (MPL)
Kelo
yes,thank you
Shukri
Can I ask you other question?
Shukri
what is monopoly mean?
Habtamu Reply
What is different between quantity demand and demand?
Shukri Reply
Quantity demanded refers to the specific amount of a good or service that consumers are willing and able to purchase at a give price and within a specific time period. Demand, on the other hand, is a broader concept that encompasses the entire relationship between price and quantity demanded
Ezea
ok
Shukri
how do you save a country economic situation when it's falling apart
Lilia Reply
what is the difference between economic growth and development
Fiker Reply
Economic growth as an increase in the production and consumption of goods and services within an economy.but Economic development as a broader concept that encompasses not only economic growth but also social & human well being.
Shukri
production function means
Jabir
What do you think is more important to focus on when considering inequality ?
Abdisa Reply
any question about economics?
Awais Reply
sir...I just want to ask one question... Define the term contract curve? if you are free please help me to find this answer 🙏
Asui
it is a curve that we get after connecting the pareto optimal combinations of two consumers after their mutually beneficial trade offs
Awais
thank you so much 👍 sir
Asui
In economics, the contract curve refers to the set of points in an Edgeworth box diagram where both parties involved in a trade cannot be made better off without making one of them worse off. It represents the Pareto efficient allocations of goods between two individuals or entities, where neither p
Cornelius
In economics, the contract curve refers to the set of points in an Edgeworth box diagram where both parties involved in a trade cannot be made better off without making one of them worse off. It represents the Pareto efficient allocations of goods between two individuals or entities,
Cornelius
Suppose a consumer consuming two commodities X and Y has The following utility function u=X0.4 Y0.6. If the price of the X and Y are 2 and 3 respectively and income Constraint is birr 50. A,Calculate quantities of x and y which maximize utility. B,Calculate value of Lagrange multiplier. C,Calculate quantities of X and Y consumed with a given price. D,alculate optimum level of output .
Feyisa Reply
Answer
Feyisa
c
Jabir
the market for lemon has 10 potential consumers, each having an individual demand curve p=101-10Qi, where p is price in dollar's per cup and Qi is the number of cups demanded per week by the i th consumer.Find the market demand curve using algebra. Draw an individual demand curve and the market dema
Gsbwnw Reply
suppose the production function is given by ( L, K)=L¼K¾.assuming capital is fixed find APL and MPL. consider the following short run production function:Q=6L²-0.4L³ a) find the value of L that maximizes output b)find the value of L that maximizes marginal product
Abdureman
types of unemployment
Yomi Reply
What is the difference between perfect competition and monopolistic competition?
Mohammed
Got questions? Join the online conversation and get instant answers!
Jobilize.com Reply

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Digital signal processing laboratory (ece 420). OpenStax CNX. Sep 27, 2006 Download for free at http://cnx.org/content/col10236/1.14
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Digital signal processing laboratory (ece 420)' conversation and receive update notifications?

Ask