Artifacts Associated With Ticket 1465666fffffffff
Ticket change [850a1c016e] (rid 131258) by afredd on 2006-04-06 11:47:48:
- assignee initialized to: "nobody"
- cmimetype initialized to: "text/plain"
- comment initialized to:
Just stumbled across a case where 8.5 appears to use more memory than 8.4 on windows. The following loop builds a list and uses the *same* amount of memory for both 8.4.8 and 8.5a4 on my machine: set lst {} for {set i 0} {$i < 2000000} {incr i} { lappend lst $i } (~56,800K for both versions.) Now just sticking a dash in front of the $i changes things: set lst {} for {set i 0} {$i < 2000000} {incr i} { lappend lst -$i } Now 8.4.8 uses 96,100K to 8.5a4's 103,724K. (In task manager there's a difference of 7K between the Mem Usage, and a difference of 8K in the VM Size). Both runs are done in fresh tclsh's. Using different item elements brings back memory usage parity eg. [lappend lst " $i "] uses the same in both. Also ".$i" uses more in 8.5 , but "..$i" gives the same. Weird! Is this additional memory usage due to a bug fix, or an (un)?intended behaviour change? Cheers. - foundin initialized to: "None"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "afredd"
- subsystem initialized to: "None"
- title initialized to: "8.5 lists sometimes uses more memory for 8.4.."
- type initialized to: "Bug"
Ticket change [8429abf0ee] (rid 117495) by dkf on 2006-04-06 19:14:41:
- assignee changed to: "msofer"
- foundin changed to: "obsolete: 8.5a4"
- priority changed to: "3 Low"
- subsystem changed to: "10. Objects"
Ticket change [e60b831711] (rid 104229) by dgp on 2006-06-21 03:40:31:
- assignee changed to: "kennykb"
- icomment:
Logged In: YES user_id=80530 something related to number formating?
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
Ticket change [fbc31e68dd] (rid 108113) by kennykb on 2006-06-21 20:37:56:
- icomment:
Logged In: YES user_id=99768 I just tested this on my machine, and I get nearly identical results between the two releases. By contrast, I get significantly different results between builds with and without --enable-threads. I expect this, since the threaded allocator has somewhat higher overheads than the non-threaded version. Can you verify that the results of [parray tcl_platform] are the same between your 8.4 and 8.5 builds?
- login: "kennykb"
- mimetype: "text/plain"
- username: "kennykb"
- icomment:
Ticket change [5b371d4d56] (rid 118279) by kennykb on 2006-06-21 20:39:02:
- closedate changed to: "2006-06-21T13:39:02"
- closer changed to: "kennykb"
- icomment:
Logged In: YES user_id=99768 Changing status to 'Pending' and resolution to 'Works for Me' - will reactivate if the original poster follows up.
- login: "kennykb"
- mimetype: "text/plain"
- resolution changed to: "Works For Me"
- status changed to: "Pending"
- username: "kennykb"
Ticket change [06c922aa89] (rid 89272) by afredd on 2006-06-21 21:50:16:
- icomment:
Logged In: YES user_id=1386588 >Can you verify that the results of [parray tcl_platform] >are the same between your 8.4 and 8.5 builds? Both give: % parray tcl_platform tcl_platform(byteOrder) = littleEndian tcl_platform(machine) = intel tcl_platform(os) = Windows NT tcl_platform(osVersion) = 5.1 tcl_platform(platform) = windows tcl_platform(user) = afredd tcl_platform(wordSize) = 4 % The 8.4.8 is a a ActiveState build. The 8.5a3 is a home built version using VS6. Just reran the test and get the original reported memory usage results. However, with a home built 8.4.6 (don't have 8.4.8 to hand) then this matches my 8.5a3. So the difference may be due to the memory allocator used by the AS build. Does this sound possible? -- On a not quite tangent... My original report came from trying to work out why i was seeing timing differences in [lsort -real...] where the list was of strings of "$i.". I thought it might be due to some kind of memory overhead, hence the report. But this was probably a red herring. Been awhile since i've looked into this, but here's a script you can try on 8.4 and 8.5 to see what i found: proc main {} { puts "Tcl [info patch]" set max 1000 for {set j 1024} {1} {set j [expr {4 * $j}]} { set lst {} for {set i 0} {$i < $j} {incr i} { lappend lst $i. ;# $i.$i ;# +$i -$i 0 .$i } set N [llength $lst] if {$N > 500000} break set M [expr {2 + int(8000000.0 / ((log($N)) * $N))}] if {$M > $max} { set M $max } ;# that's plenty! lsort -real $lst ;# flush timing puts "$N\t ($M)\t [lindex [time {lsort - real $lst} $M] 0]" } } main # >% And my results: Tcl 8.5a3 1024 (1000) 567.529 4096 (236) 2700.5381355932204 16384 (52) 12117.807692307691 65536 (13) 57660.46153846154 262144 (4) 262260.5 Tcl 8.4.6 1024 (1000) 286 4096 (236) 1425 16384 (52) 6315 65536 (13) 30047 262144 (4) 132042 ie. 8.5 is significantly slower. The seemingly obvious candidate is 8.5's new real number parsing code... but when i looked into this closely i couldn't show this to be the case. Can you replicate my timing differences? - login: "afredd"
- mimetype: "text/plain"
- status changed to: "Open"
- username: "afredd"
- icomment:
Ticket change [d5655cb9ee] (rid 123616) by dgp on 2006-06-22 02:02:15:
- icomment:
Logged In: YES user_id=80530 Looks like a slowdown in Tcl_GetDoubleFromObj(). There should be much less noise in timing comparisons of this in both releases: time {binary format d 17.} 10000 I see change from ~13us to ~22us. - login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Ticket change [77f3e7f8c2] (rid 89864) by dgp on 2006-06-22 02:09:18:
- icomment:
Logged In: YES user_id=80530 The slowdown appears to be due to the addition of a check for the NaN value, so an error can be raised when that value is stored in the Tcl_Obj. It's been a matter of some discussion how NaN values ought to be handled, so this may not be the final word on the subject.
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Ticket change [da47e8ed74] (rid 107745) by kennykb on 2007-01-03 22:49:39:
- closedate changed to: "2007-01-03T15:49:39"
- closer changed to: "kennykb"
- icomment:
Logged In: YES user_id=99768 Originator: NO It is indeed true that Tcl_GetDoubleFromObj is slower on Windows in 8.5 than it was in 8.4 - but should be slower only when it actually has to shimmer a string. It is also true that the old Tcl_GetDoubleFromObj fails dozens, if not hundreds, of the roundoff tests in expr-28.*. To some extent, we appear to be facing a choice between "fast" and "correct." Since the memory management appears to be exonerated, and since the performance change appears to be something that we've accepted for the moment, I'm closing out this issue. A note to the original submitter. Rather that using "$i." to convert an integer to floating point, it's both faster and safer to use [expr {double($i)}] -- and note the curly braces. That won't trouble to generate a string representation of the 'double' until it's needed, and will do the integer-to-double conversion without going through an intermediate string representation. In most of your examples, it will save both space and time. - login: "kennykb"
- mimetype: "text/plain"
- resolution changed to: "None"
- status changed to: "Closed"
- username: "kennykb"
Ticket change [aaf50a26b2] (rid 101011) by dkf on 2007-01-04 01:01:42:
- resolution changed to: "Wont Fix"