Re: Tcl/Lisp/Python: A "User" point of view

Paul Alexander (pa@mrao.cam.ac.uk)
29 Sep 1994 17:58:04 GMT

In article <36cafa$5ue@btree.brooktree.com>, mdimeo@brooktree.com (Matt DiMeo) writes:
|> In article <1994Sep27.085636.23932@paramount.nikhefk.nikhef.nl>,
|> Jeffrey Templon <templon@paramount.nikhefk.nikhef.nl> wrote:
|> >I haven't yet read all 101 replies on this thread. I do want
|> >to make some comments from a more "user-oriented" standpoint;
|> >I mean, I will be making commments based solely on using
|> >this sort of language for "end-user" projects; you won't hear
|> >anything about O(1) vs. O(n) ...
|>
|> 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.
|>
|> -Matt

Well using _standard_ tcl:

for { set i 0 } { $i < 10000 } { incr i } {
lappend l $i
}

(i.e. lappend not lvarpush)

I get:

PERL:
-----
/bin/time /usr/local/bin/perl lap.perl
6.4 real 6.1 user 0.1 sys

TCL:
----
/bin/time /soft/tcl/bin/tclsh lap.tcl
1.4 real 1.3 user 0.0 sys

--------------

Paul Alexander
Department of Physics, Cavendish Laboratory,
University of Cambridge,
Cambridge, UK.