[TV] In the context (but limited to) of [apache server with tcl cgi scripts running on safe user] I've done some small tests to compare signal processing loops in tcl with C, primarily speed-wise. Of course a loop is not the same as computations, and a compilation not the same as a free run-time interpreted program such as tcl can handle, and moreover tcl/tk scripts can very well drive a C compiler to make it's use more comfortable. I can get pretty fast not-so-big C compiles running on moderately fast machines running Linux, expecially when using a Ram disk for temporary data storage: export TMP=/dev/shm export TEMP=/dev/shm In a bash shell. The first Tcl test program is very short: ~/Math [1008] $ cat > test1.tcl for {set i 0} {$i < 100000} {incr i} {set y [expr 10*$i] } ~/Math [1009] $ time tclsh test1.tcl real 0m1.021s user 0m0.962s sys 0m0.006s The equivalent in C, but with a 1e3 times longer loop: ~/Math [1053] $ cat test1.c #include main() { int i; long int y = 0; for (i=0; i<100000000; i++) y+=10*i; printf("%ld\n",y); } ~/Math [1054] $ gcc -o test1 test1.c ~/Math [1055] $ time ./test1 49999999500000000 real 0m0.505s user 0m0.379s sys 0m0.001s Ok, 2000 times faster loop, and this length is the static compiled crossover point as a result of the compilatation taking a part of 1 second. Now with processing: ~/Math [1056] $ cat test2.tcl set y 0; for {set i 0} {$i < 100000} {incr i} {set y [expr $y + sin($i/10000)]} puts $y ~/Math [1057] $ time tclsh test2.tcl 19552.09482105695 real 0m3.997s user 0m3.173s sys 0m0.007s In C: ~/Math [1058] $ cat test2.c #include #include main() { int i; double y = 0; for (i=0; i<100000000; i++) y+=sin(i/10000); printf("%lf\n",y); } ~/Math [1059] $ gcc -O -o test2 test2.c -lm ~/Math [1060] $ time ./test2 19395.054107 real 0m10.094s user 0m7.659s sys 0m0.020s ~/Math [1061] $ time ./test2 19395.054107 real 0m8.081s user 0m8.030s sys 0m0.003s ~/Math [1062] $ time ./test2 19395.054107 real 0m7.949s user 0m7.895s sys 0m0.009s ~/Math [1063] $ Of course the overhead of the loop starts to count less, and probably tcl used the same C library sin() call, so not 2000 but 500 times faster. (the last two time-s I switched of the TV running on the same machine). Someone want to compare multicore or VHDL ? Oh, another good practicum question: why is the result from the C and the tcl code ''exactly'' different?! ---- [TV] ''Sept 3 ยด08'' I add a page about a similar subject [List computations in a FPGA, driven by Tcl] which is interesting to compare speeds. ---- !!!!!! %| [Category Performance]|[Category Testing] |% !!!!!!