On Jun 23, 2010, at 6:58 AM, Tom Browder wrote:

> How much efficiency is gained (or lost) by writing the complete series
> of commands to a script first, and then feeding it to mged in one
> chunk?

It depends what commands you are calling and what operating system  
you are on.  On most modern operating systems (e.g., Linux, Mac, and  
Windows) process initialization has a very high overhead, so this can  
be a substantial amount of time.  Moreover, most of BRL-CAD's library  
calls are pretty tuned for performance, so an individual command will  
only amount to a minor fraction of a percent on the overall run- 
time.  Batching them together can save more than two orders of  
magnitude on the overall run-time for simple geometry editing commands.

In the spiral script example, there are 1500 "segments" getting  
generated.  Each segment is generated with 9 MGED commands.  That's a  
total of 13500 MGED commands getting run.

Batching the segments together in sets of 200 (i.e., 1800 commands at  
a time) takes LESS overall runtime than invoking MGED one segment at  
a time for just 10 segments (i.e., 9 commands at a time, 90 total  
commands).

Basically, that just reinforces the notion that the time it takes for  
the operating system to create, initialize, and schedule a new  
process along with MGED's own initialization time is about two orders  
of magnitude longer than a basic editing command.  If you edit  
spiral.pl and change the "$i % 100" to "%i % 1", you will see this  
difference.  If your MGED commands are computation intensive,  
however, (such as facetize or rt or gqa) then all bets are off.

Cheers!
Sean


------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
BRL-CAD Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-users

Reply via email to