Re: Math calculations in TCL - performance
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.tcl archive

Re: Math calculations in TCL - performance

From: Adrian Ho <tcl@03s.net>
Date: Fri Feb 24 2006 - 07:53:54 CET

On 2006-02-24, MH <mghembru@harshrealm.uwaterloo.ca> wrote:
> Well.. We have an application where I'm reading 50K lines from a file,
> parsing each line, putting it into a QT vector object, etc..
>
> Pure Tcl (includes some Canvas operations): 8.x seconds.
> Re-coded in C (including similar drawing operations in QT): ~0.4 seconds.
> (note: C really = C++)
> [...]
> So, just calculating the data structures was something like: 4.x vs 0.2
> (speedup of approx 25X).
> [...]
> Wouldn't mind seeing us use Tcl code - a little simpler, more flexible and
> easier to maintain. But, we REALLY can't ignore a 20-25X slowdown.

As I see it (and it's possible I'm missing some vital restriction, so
caveat emptor), you can still use Tcl, but you may want to harken back
to Tcl's heritage as a Tool Command Language, i.e. do the bulk of the
work in C++ but expose the necessary "control points" as Tcl commands.
It sounds like you're already at least half-way there anyway.

The key thing to remember in your case is to reduce to a minimum the
amount of data crossing the Tcl-C++ border. Done properly (i.e. carefully
and with much thought), you can have your Tcl cake and eat it in 0.2
seconds. 8-)

G'luck!

- Adrian
Received on Sun Apr 30 02:14:37 2006