Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 06c922aa89edaf1c22b6d10aa27dd0b2e0032f42
Ticket: 1465666fffffffffffffffffffffffffffffffff
8.5 lists sometimes uses more memory for 8.4..
User & Date: afredd on 2006-06-21 21:50:16
Changes

  1. 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?
    
    
    
    
    
    
    
  2. login: "afredd"
  3. mimetype: "text/plain"
  4. status changed to: "Open"
  5. username: "afredd"