From: Paul O. <pa...@po...> - 2023-08-07 19:03:25
|
Can anybody confirm the slow behaviour of the "array get" command in Tcl 9? Noticed on both Windows and Linux. Regards, Paul puts "Using Tcl [info patchlevel] on $tcl_platform(platform)" catch { puts "Build-Info: [tcl::build-info]" } set startTime [clock milliseconds] for { set i 1 } { $i < 6000 } { incr i } { set arr(Key-$i) "Value-$i" } puts "Build time: [expr { [clock milliseconds] - $startTime }] msec" set startTime [clock milliseconds] set tmp [list] foreach {key val} [array get arr "*"] { lappend tmp $val } puts "Get time : [expr { [clock milliseconds] - $startTime }] msec" exit 0 Using Tcl 8.6.13 on windows Build time: 4 msec Get time : 3 msec Using Tcl 8.7b1 on windows Build-Info: 8.7b1+ecfb784c4c615a02410a54b592d4e604ece775f53bf6f6957dff581bf41c16fa.gcc-702.ilp32 Build time: 4 msec Get time : 4 msec Using Tcl 9.0b1 on windows Build-Info: 9.0b1+ec928fe7530ca16727d54953cf107dd494cc9d9b10c5d5de74434624b1270e60.gcc-702.ilp32 Build time: 5 msec Get time : 3029 msec |
From: Steve L. <st...@di...> - 2023-08-08 00:06:12
|
confirmed on macOS too -- Steve On 8 Aug 2023 at 3:04 AM +0800, Paul Obermeier <pa...@po...>, wrote: > > puts "Using Tcl [info patchlevel] on $tcl_platform(platform)" > catch { puts "Build-Info: [tcl::build-info]" } > > set startTime [clock milliseconds] > for { set i 1 } { $i < 6000 } { incr i } { > set arr(Key-$i) "Value-$i" > } > puts "Build time: [expr { [clock milliseconds] - $startTime }] msec" > > set startTime [clock milliseconds] > set tmp [list] > foreach {key val} [array get arr "*"] { > lappend tmp $val > } > puts "Get time : [expr { [clock milliseconds] - $startTime }] msec" > > exit 0 |
From: <apn...@ya...> - 2023-08-08 06:12:23
|
Reproduced on Windows and happens even with an empty loop body. It appears the slowdown is caused by the DictAsListIndex function which is present in 9 but not 8.7. In an attempt to avoid shimmering the dict to a list, it parses the string rep on every indexing operation. I don't know the dict internal representation but given it maintains a list order (I think?), but changing DictAsListIndex to make use of that would make more sense. In any case, the current implementation is not workable. /Ashok -----Original Message----- From: Paul Obermeier <pa...@po...> Sent: Tuesday, August 8, 2023 12:14 AM To: tcl...@li... Subject: [TCLCORE] "array get" is very slow in Tcl9 Can anybody confirm the slow behaviour of the "array get" command in Tcl 9? Noticed on both Windows and Linux. Regards, Paul puts "Using Tcl [info patchlevel] on $tcl_platform(platform)" catch { puts "Build-Info: [tcl::build-info]" } set startTime [clock milliseconds] for { set i 1 } { $i < 6000 } { incr i } { set arr(Key-$i) "Value-$i" } puts "Build time: [expr { [clock milliseconds] - $startTime }] msec" set startTime [clock milliseconds] set tmp [list] foreach {key val} [array get arr "*"] { lappend tmp $val } puts "Get time : [expr { [clock milliseconds] - $startTime }] msec" exit 0 Using Tcl 8.6.13 on windows Build time: 4 msec Get time : 3 msec Using Tcl 8.7b1 on windows Build-Info: 8.7b1+ecfb784c4c615a02410a54b592d4e604ece775f53bf6f6957dff581bf41c16fa.gcc-702.ilp32 Build time: 4 msec Get time : 4 msec Using Tcl 9.0b1 on windows Build-Info: 9.0b1+ec928fe7530ca16727d54953cf107dd494cc9d9b10c5d5de74434624b1270e60.gcc-702.ilp32 Build time: 5 msec Get time : 3029 msec _______________________________________________ Tcl-Core mailing list Tcl...@li... https://lists.sourceforge.net/lists/listinfo/tcl-core |
From: <apn...@ya...> - 2023-08-08 06:16:16
|
Ticketed and temporarily fixed in trunk by disabling DictAsListIndex. -----Original Message----- From: apnmbx-public--- via Tcl-Core <tcl...@li...> Sent: Tuesday, August 8, 2023 11:42 AM To: 'Paul Obermeier' <pa...@po...>; tcl...@li... Subject: Re: [TCLCORE] "array get" is very slow in Tcl9 Reproduced on Windows and happens even with an empty loop body. It appears the slowdown is caused by the DictAsListIndex function which is present in 9 but not 8.7. In an attempt to avoid shimmering the dict to a list, it parses the string rep on every indexing operation. I don't know the dict internal representation but given it maintains a list order (I think?), but changing DictAsListIndex to make use of that would make more sense. In any case, the current implementation is not workable. /Ashok -----Original Message----- From: Paul Obermeier <pa...@po...> Sent: Tuesday, August 8, 2023 12:14 AM To: tcl...@li... Subject: [TCLCORE] "array get" is very slow in Tcl9 Can anybody confirm the slow behaviour of the "array get" command in Tcl 9? Noticed on both Windows and Linux. Regards, Paul puts "Using Tcl [info patchlevel] on $tcl_platform(platform)" catch { puts "Build-Info: [tcl::build-info]" } set startTime [clock milliseconds] for { set i 1 } { $i < 6000 } { incr i } { set arr(Key-$i) "Value-$i" } puts "Build time: [expr { [clock milliseconds] - $startTime }] msec" set startTime [clock milliseconds] set tmp [list] foreach {key val} [array get arr "*"] { lappend tmp $val } puts "Get time : [expr { [clock milliseconds] - $startTime }] msec" exit 0 Using Tcl 8.6.13 on windows Build time: 4 msec Get time : 3 msec Using Tcl 8.7b1 on windows Build-Info: 8.7b1+ecfb784c4c615a02410a54b592d4e604ece775f53bf6f6957dff581bf41c16fa.gcc-7 02.ilp32 Build time: 4 msec Get time : 4 msec Using Tcl 9.0b1 on windows Build-Info: 9.0b1+ec928fe7530ca16727d54953cf107dd494cc9d9b10c5d5de74434624b1270e60.gcc-7 02.ilp32 Build time: 5 msec Get time : 3029 msec _______________________________________________ Tcl-Core mailing list Tcl...@li... https://lists.sourceforge.net/lists/listinfo/tcl-core _______________________________________________ Tcl-Core mailing list Tcl...@li... https://lists.sourceforge.net/lists/listinfo/tcl-core |