Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » DSDP - Real-Time Software Components (RTSC) » Optimizations for speed
Optimizations for speed [message #721501] Thu, 01 September 2011 23:05
linkinsebas is currently offline linkinsebasFriend
Messages: 22
Registered: April 2011
Junior Member
The module primer emphasizes that the same speed can be reached by using RTSC modules' functions and old-fashioned #define macros. What do I have to do to to get this?

For example, I have a module's function

Float Math_abs(Float number)
{
    return (number>0?number:-number);
}


How do I make this as fast as the following macro?

#define mf_abs(x) (x>0?x:-x)


I have been building the package like this:

var Build = xdc.useModule('xdc.bld.BuildEnvironment');
var Pkg = xdc.useModule('xdc.bld.PackageContents');
 
for each (var targ in Build.targets) {
    Pkg.addLibrary("lib/" + Pkg.name, targ, {profile: "whole_program"}).addObjects(["Math.c"]);
}


and using a ccsv4-based client program that calls both functions like this:

y_abs_mf=mf_abs(x_abs);
y_abs_Math=Math_abs(x_abs);


According to ccsv4's clock, the first one takes 5 instruction cycles, but the second one takes 14. How can I make this better?

Also I am interested in the following situation. I need to have a module where some variables are set at configuration time depending on one other config, but used as constants outside the module during run time. I figured that these variables have to be configs too, since constants declared in a module cannot be modified even in a configuration script (can they?). The module primer (lesson 6) says that configs can effectively become literals (#define). How can I get to do this? For example, my test client code goes like this:

y_const=def_const;
y_const=Math_count;


where def_const is a constant defined using #define, and count is a config from module Math. According to ccsv4's clock, the first one only takes one instruction, but the second one takes 3 (if I define count as const instead of config, I can get the second line to take only 1 instruction cycle).

Thanks for your help.
Previous Topic:dash in package name
Next Topic:access enums of a proxy
Goto Forum:
  


Current Time: Thu Oct 03 20:25:06 GMT 2024

Powered by FUDForum. Page generated in 0.02652 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top