Subject: Re: speed - DN [1]
jeff_hobbs@my-dejanews.com - 10 Dec 1998 - comp.lang.tcl
In article
<Pine.OSF.3.95.981210080428.1727A-100000@krisal.physik.uni-karlsruhe.de>,
Johannes Zellner <joze@krisal.physik.uni-karlsruhe.de> wrote:
> recently I tested the scriptics pro compiler concerning speed.
> I did this with small test scripts and with rather large applications
> where pretty a lot of calculation is done.
>
> My tests showed no significant speed improvement of the byte compiled
> scripts compared to the plain tcl scripts.
Remember that after a proc is loaded, it is byte-compiled when it is
first called anyway. The benefit of the TclPro byte-compiler, I believe,
is more to reduce some overhead in the initial load and compilation, and
to some extent to obscure code for those angst-ridden with copyright
violation worries.
If you are looking to really speed up your code, start with a few basic
steps:
* make sure all expr expressions are {}ed
* take advantage of the way objects work (lists can be *fast*)
* don't go switching objects between types unnecessarily
* ie: don't take an args list and use [string match] to see
if it is empty, use [llength] instead
* use num vars as numbers (as long as reasonable), etc...
* use associative arrays where appropriate
* there aren't appropriate for 1D num arrays (use lists)
* reduce the use of eval as much as possible, as it throws out
any advantage of byte-compilation
* some people don't use the extended foreach syntax to enough advantage...
* add your rec here (there are definitely other good, basic points)
If you are worried about load-up speed, the TclPro compiled version
should be faster. Another thread earlier this week noted that excessive
commenting can slow down startup (Tcl has to read in all those comments
before it knows to skip them), but not run-time speed.
If things still don't satisfy, perhaps vanilla Tcl isn't the solution.
I wouldn't try JPEG compression or earthquake simulation in raw Tcl,
although it is theoretically possible. This is where the advantage of
being able to tie Tcl with C code easily comes in. This might be an
option for you.
--
jeff.hobbs @SPAM acm.org
jeffrey.hobbs @SPAM icn.siemens.de
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
Last modified
1999-09-27
1999-09-27
(195.108.246.50)
Note: you are looking at
the snapshot of an old wiki
- much of this information
is likely to be very outdated
