>The users will care about O(1) vs. O(n) as soon as they notice how long it
>takes for tcl to build up a ten thousand element list.
>tst.tcl------------------
>set l ""
>for { set i 0 } { $i < 10000 } { incr i } {
> lvarpush l $i
>}
>-------------------------
>tst.perl-----------------
>for ($i = 0 ; $i < 10000 ; $i++) {
> unshift(@f, $i) ;
>}
>-------------------------
>{/home/mdimeo}% /bin/time /cad/bin/perl tst.perl
> 4.8 real 4.6 user 0.0 sys
>{/home/mdimeo}% /bin/time tcl tst.tcl
>^CCommand terminated abnormally.
> 334.2 real 326.7 user 0.2 sys
>
>I control-C'd the tcl one, 'cause I got tired of waiting. You get the idea.
>Lisp would have been fast, probably faster than perl.
I don't know where you learned tcl, because I never heard of a function
called lvarpush. I always thought it is called lappend (for list append).
so here is my tst.tcl:
tst.tcl------------------
for { set i 0 } { $i < 10000 } { incr i } {
lappend l $i
}
-------------------------
tst.perl like above. Here are the times on my HP735:
%time perl tst.perl
2.21u 0.04s 0:02.25 100.0%
%time tclsh tst.tcl
0.80u 0.03s 0:00.87 95.4%
So what did you prove?
Bernd
--- Bernd Mohr -- mohr@cs.uoregon.edu -- http://www.cs.uoregon.edu/~mohrecho '[q]sa[ln0=aln256%Pln256/snlbx]sb3135071790101768542287578439snlbxq'|dc