Artifacts Associated With Ticket dfccbeb623afe3f6
Ticket change [72c2569c71] (rid 139304) by anonymous on 2014-08-19 16:09:26:
- assignee initialized to: "nobody"
- closer initialized to: "nobody"
- cmimetype initialized to: "text/plain"
- comment initialized to:
The following snippet of code takes about 30 seconds in Tcl 8.6, but runs in well under a second in Tcl 8.5. The problem is something to do with the upvar, and with the fact that "lappend" appends two elements at once -- if you replace the call with two "lappend"s of one element each, it runs fast. ============================= proc ArrayGetSorted {arrayPtr} { set result {} upvar 1 $arrayPtr arrayName set nameList [array names arrayName] puts "Start [clock seconds]" foreach name $nameList { lappend result $name $arrayName($name) } puts "Done [clock seconds]" return $result } for {set n 0} {$n < 40000} {incr n} { set arr([list top [expr rand()] [expr rand()]]) data } ArrayGetSorted arr ============================= - foundin initialized to: "8.6"
- is_private initialized to: "0"
- login: "anonymous"
- priority initialized to: "5 Medium"
- private_contact initialized to: "21e680c66afc6863cbbaf0aa5b26c9e8a4429339"
- resolution initialized to: "None"
- severity initialized to: "Important"
- status initialized to: "Open"
- submitter initialized to: "anonymous"
- subsystem initialized to: "17. Commands I-L"
- title initialized to: "lappend very slow in tcl 8.6"
- type initialized to: "Bug"
Ticket change [9f17bc27a5] (rid 139305) by aku on 2014-08-19 16:52:15:
- assignee changed to: "dkf"
- icomment:
The lappend issue is a duplicate of a bug which got recently fixed. Hm. ... There is [1332fc7df2]; which is still open. Found it, the issue was [b43f2b49f7]. The fix for that should be in the 8.5.16 release candidates, so you should be able to test if that fixes your issue. Assigning to dkf to say more.
- login: "aku"
- mimetype: "text/plain"
- severity changed to: "Severe"
Ticket change [82b909898e] (rid 139306) by aku on 2014-08-19 16:54:01:
- icomment:
The relevant checkin having the fix is [17150b71d2419a4db61140f860b58f7564be8ec9] of Jun 18.
- login: "aku"
- mimetype: "text/plain"
- icomment:
Ticket change [9769208389] (rid 139307) by anonymous on 2014-08-19 17:09:00:
- icomment: "So, it will be fixed in Tcl 8.6.2 ?"
- login: "anonymous"
- mimetype: "text/plain"
- username: "jal_frezie"
Ticket change [77a76ef3f5] (rid 139308) by aku on 2014-08-19 17:24:42:
- icomment:
My mention of 8.5.16 was a typo. My apologies. I meant 8.6.2. The current RC archives can be found at ftp://ftp.tcl.tk/pub/tcl/tcl8_6/ - login: "aku"
- mimetype: "text/plain"
- icomment:
Ticket change [52f11052f0] (rid 139394) by dkf on 2014-08-28 09:13:17:
- closedate changed to: "2456897.88422705"
- closer changed to: "dkf"
- icomment:
This was a bug in the lappend compiler, [b43f2b49f7], which was generating code that didn't handle refcounts well in 8.6.1; the fact that using two simple lappends was a workaround was a pretty strong indicator of exactly that bug. Already fixed in 8.6.2.
- login: "dkf"
- mimetype: "text/x-fossil-wiki"
- resolution changed to: "Duplicate"
- status changed to: "Closed"
- username: "dkf"