Re: TclX loop slow in the default case
- From: Evil Son <ewilsonmail@xxxxxxxxx>
- Date: Wed, 27 Aug 2008 20:11:50 -0700 (PDT)
ed@aleph> tclsh8.5 run-tests.tcl 10000
8.4.18 8.5.3 ratio proc
1960 1699 0.87 tcl_for
5481 16175 2.95 loop_default
9020 11777 1.31 loop_eval <-- naive implemenation
And here is the result if I use a fixed increment (what is the default
case). i.e.
proc my_loop {index init bound inc script} {
upvar 1 $index i
for {set i $init} {$i < $bound} {incr i} { ;# we dont use incr i
$inc
uplevel 1 $script
}
}
ed@aleph> tclsh8.5 run-tests.tcl 10000
8.4.18 8.5.3 ratio proc
1965 1705 0.87 tcl_for
5400 17278 3.20 loop_default
8620 10818 1.25 loop_eval_fixed_increment
The last line removes the cost of a single variable access
i.e. 8620 vs 9020
.
- References:
- TclX loop slow in the default case
- From: Evil Son
- Re: TclX loop slow in the default case
- From: Alexandre Ferrieux
- Re: TclX loop slow in the default case
- From: Evil Son
- Re: TclX loop slow in the default case
- From: Donal K. Fellows
- Re: TclX loop slow in the default case
- From: Evil Son
- TclX loop slow in the default case
- Prev by Date: Re: TclX loop slow in the default case
- Next by Date: Re: TclX loop slow in the default case
- Previous by thread: Re: TclX loop slow in the default case
- Next by thread: Re: TclX loop slow in the default case
- Index(es):
Relevant Pages
|