Re: TclX loop slow in the default case
- From: "Donal K. Fellows" <donal.k.fellows@xxxxxxxxx>
- Date: Sun, 31 Aug 2008 04:47:28 -0700 (PDT)
Alexandre Ferrieux wrote:
Also, can you explain why the cheats are still 3.75 times behind naked
[for] (see Evil Son's post) ?
At an (informed) guess, because the variables still aren't being bound
directly to local variable table indices (though the LVT indices may
be being stored in the internal representation of the variable names)
and that forces time to be spent parsing variables and dealing with
hash tables. This is because the loop variable in the test harness
isn't actually being assigned a slot in the LVT at all.
Using (a corrected version of) Miguel's cheatloop2, I get this:
% proc c2 {} {cheatloop2 x 0 10000 {}}
% time c2 1000
2078.150919 microseconds per iteration
% proc c2 {} {set x {}; cheatloop2 x 0 10000 {}}
% time c2 1000
712.200715 microseconds per iteration
For comparison:
% proc floop {} {for {set x 0} {$x<10000} {incr x} {}}
% time floop 1000
636.676754 microseconds per iteration
Not bad given that you've got the overhead of dynamic programming!
(Also note that the disassembly of the thing generated inside
[cheatloop2] is different in the two cases. Remember to put the probe
after the [uplevel] call if you're testing this yourself.)
Donal.
.
- References:
- 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: Alexandre Ferrieux
- Re: 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: Donal K. Fellows
- Re: TclX loop slow in the default case
- From: Alexandre Ferrieux
- Re: TclX loop slow in the default case
- From: miguel
- Re: TclX loop slow in the default case
- From: Alexandre Ferrieux
- TclX loop slow in the default case
- Prev by Date: Re: TclX loop slow in the default case
- Next by Date: Re: Something to consider re ever more byzantine builds
- Previous by thread: Re: TclX loop slow in the default case
- Next by thread: Re: TclX loop updated
- Index(es):
Relevant Pages
|