Newsgroups: gnu.misc.discuss,comp.lang.tcl,comp.lang.scheme,comp.lang.python
From: Tim.Bunce@ig.co.uk (Tim Bunce)
Path: cantaloupe.srv.cs.cmu.edu!das-news.harvard.edu!news2.near.net!MathWorks.Com!news.duke.edu!convex!cs.utexas.edu!howland.reston.ans.net!news.sprintlink.net!demon!ig.co.uk!timbo
Subject: Re: Tcl/Lisp/Python: A "User" point of view
References: <9409232314.AA29957@mole.gnu.ai.mit.edu> <KFOGEL.94Sep24225539@ninja.life.uiuc.edu> <1994Sep27.085636.23932@paramount.nikhefk.nikhef.nl> <36cafa$5ue@btree.brooktree.com>
Organisation: Paul Ingram Group, Software Systems, +44 483 424424
Date: Fri, 30 Sep 1994 11:01:02 +0000
Message-ID: <Cwxvxr.DGE@ig.co.uk>
Sender: usenet@demon.co.uk
Lines: 42
Xref: glinda.oz.cs.cmu.edu gnu.misc.discuss:18595 comp.lang.tcl:19704 comp.lang.scheme:10149 comp.lang.python:1815

In article <36cafa$5ue@btree.brooktree.com> mdimeo@brooktree.com (Matt DiMeo) writes:
>
>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) ;
>}
>-------------------------

Why are you using unshift? I hardly know tcl at all so I don't know
what lvarpush does. Perl unshift adds items to the beginning of a
list, push add items to the end.

>{/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'll just offer this perl 5 timing:

$ time perl -e 'for ($i = 0 ; $i < 10000 ; $i++){   push(@f,$i)}'

real        0.5
user        0.3
sys         0.1

Most of that time is process startup.

>-Matt

Regards,
Tim Bunce.
