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: Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at>
Date: Fri Feb 17 2006 - 10:46:36 CET

nightwatch77 <rafal.gwizdala@gmail.com> wrote:
> My test results were the following:
> sin(), cos() operations - 430 000 per second in TCL, 6 500 000 per
> second in C
> multiplication, division - 280 000 per second in TCL, 43 000 000 per
> second in C (!!!)
> The basic operator (*/+-) performance in TCL is very poor compared to
> pure C, and this is the place I would like to improve the most. Pleease
> suggest something.

My first suggestion is:
Share with us the code you used for your performance tests.
  There are some (unfortunately common) *bad* idioms used
  that kill performance extremely. Most prominent example
  is using expr without braces.

Once your test-procedure is verified to be optimal, only then
it makes sense to think about further tcl-internal optimizations.

Finally, if you *really* need C-like FLOPS for some tcl-app
of yours, you'll likely have to write a C-extension that does
the heavy-duty math.
Received on Sun Apr 30 02:08:28 2006