Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
Mathematics
General TopicsResearchOperations ResearchStatisticsMathematical LogicNumerical AnalysisUndergraduate MathAlgebra HelpRecreational Math
Math Software
MapleMathematicaMATLABScilabSASSPSS

Math Forum / Math Software / Scilab / December 2008



Tip: Looking for answers? Try searching our database.

Ways of Speeding Execution

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Tim Wescott - 30 Dec 2008 23:58 GMT
I'm writing a Kalman filter application that involves going through big
piles of data.  The Kalman filter itself has numerous intermediate steps
to simulate the plant, which in turn has embedded calculations using
quaternions, for which I had to work up a Scilab data type.

It runs slooowly.  Each second of real-world data takes about 1.3 to 1.5
seconds to execute.  As I'm getting to a stage of the game where I need
to run this over and over again while I tune and tweak, execution time is
suddenly important to me.

What general strategies can I take to speed this up?  

I have already "vectorized" the code to a great extent; I may be able to
do more but only at great cost to readability and flexibility -- I'd
rather spend more time in simulations at this point than in struggling
with oddball code.

My understanding is that when I load a function into Scilab it is
automatically compiled -- is that correct, or are there opportunities for
speed gains with the code I have?

Beyond this, my understanding is that I need to identify the most often-
called functions and write them in C (I'm already doing this for another
project, so I know how).  Is this it?  Does Scilab have any profiling
tools to help me decide what functions to flog first?  I'd love it if I
could print out a report that said what percent of the processor's time
was spent in which function -- is there any way to extract this
information, and if so how?

Comments and direction are welcome.  Thanks.

Signature

Tim Wescott
Control systems and communications consulting
http://www.wescottdesign.com

Need to learn how to apply control theory in your embedded system?
"Applied Control Theory for Embedded Systems" by Tim Wescott
Elsevier/Newnes, http://www.wescottdesign.com/actfes/actfes.html

Francois Vogel - 31 Dec 2008 09:32 GMT
Tim Wescott said on 31/12/2008 00:58:
> Beyond this, my understanding is that I need to identify the most often-
> called functions and write them in C (I'm already doing this for another
> project, so I know how).  Is this it?  Does Scilab have any profiling
> tools to help me decide what functions to flog first?

Yes. But read further.

> I'd love it if I
> could print out a report that said what percent of the processor's time
> was spent in which function -- is there any way to extract this
> information, and if so how?

help profile in Scilab 4.1.2 will spit three matches, all related to
profiling Scilab code. In Scilab 4.1.2, the function has to be
prepared for profiling by getf(...,"p"). In Scilab 5 you can use
add_profiling and similar commands (see their help page).

Beware of the bugs that profiling functions suffer from...
http://bugzilla.scilab.org/buglist.cgi?short_desc_type=allwordssubstr&short_desc
=profile&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED


IMO some of these bugs unfortunately just turn these functions into
useless curiosities, for instance see:
http://bugzilla.scilab.org/show_bug.cgi?id=3816#c1

Francois
ycollet - 31 Dec 2008 09:40 GMT
A stupid way to accelerate your code, if you use scilab-5 in gui mode.
If you print a lot of message in the scilab console, clear the console
from time to time or launch your code in nw mode (scilab -nw under
linux or Scilex under windows).

Scilab-5 in GUI mode slows down as the console gets full of message
(there is no limit in the size of the message history in GUI mode, in
NW under windows the size of the history is several tenth of lines).

YC
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2010 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.