Skip to content
Tcl Source Code History Of Ticket fa5c8a8230
Login

History Of Ticket fa5c8a8230

Artifacts Associated With Ticket fa5c8a8230

  1. Ticket change [0643cd548d] (rid 153785) by pooryorick on 2017-05-18 05:49:19:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/x-fossil-wiki"
    4. comment initialized to:
      The following script consumes at least 1GB of memory:
      
      <code><verbatim>
      for {set i 0} {$i < 10000} {incr i} {
          set name [namespace eval ${name}[set name {}]::namespace$i {
              namespace current
          }]
      }
      </verbatim></code>
      
      It seems that the fully-qualified name of each created namespace is getting
      stored somewhere.
      
    5. foundin initialized to: "8.7"
    6. is_private initialized to: "0"
    7. login: "pooryorick"
    8. priority initialized to: "5 Medium"
    9. private_contact initialized to: "e476148cded301ffff84bcdc432536dc0c949e88"
    10. resolution initialized to: "None"
    11. severity initialized to: "Minor"
    12. status initialized to: "Open"
    13. submitter initialized to: "pooryorick"
    14. subsystem initialized to: "21. [namespace]"
    15. title initialized to: "memory cost of nested namespaces"
    16. type initialized to: "Bug"
  2. Ticket change [3a1529fdc9] (rid 153786) by sebres on 2017-05-18 07:26:06:

    1. assignee changed to: "sebres"
    2. foundin changed to: ">= 8.5"
    3. icomment:
      Seems to affect 8.5 and 8.6 in same manner also.
      
      Additionally it've very large execution time exploding.
      Just as comparison to not-nested (>= 8.6, x86):
      
      <code><verbatim>
      # not nested:
      set i 0; time {namespace eval ::namespace[incr i] {}} 10000
      ----> 4.74 microseconds per iteration (and 8.0MB memory)
      # nested:
      set name {}; 
      set i 0; time {namespace eval [set name ${name}::namespace[incr i]] {}} 10000
      ----> 70110.60 microseconds per iteration (and 770.0MB memory)
      </verbatim></code>
      
      This difference looks in 8.5 still many times worse and the execution time exploding is very grave (with the similar memory consumption like 8.6).
      
      <code><verbatim>
      % # not nested:
      % set i 0; time {namespace eval ::namespace[incr i] {}} 10000
      2.91753049225468 microseconds per iteration
      %
      % # nested:
      % set name {};
      % # 1. thousand:
      % set i 0; time {namespace eval [set name ${name}::namespace[incr i]] {}} 1000
      1153.3163043544507 microseconds per iteration
      % # 2. thousand:
      % set i 0; time {namespace eval [set name ${name}::namespace[incr i]] {}} 1000
      7032.770893726276 microseconds per iteration
      % # 3. thousand:
      % set i 0; time {namespace eval [set name ${name}::namespace[incr i]] {}} 1000
      18984.08208553774 microseconds per iteration
      %
      </verbatim></code>
      
    4. login: "sebres"
    5. mimetype: "text/x-fossil-wiki"
    6. title changed to:
      memory cost and execution time exploding of nested namespaces
      
  3. Ticket change [ca4addf7d4] (rid 153787) by sebres on 2017-05-18 08:12:41:

    1. icomment:
      The memory consumption going to large full-qualified namespace name.
      Following example explain it (has comparable memory consumption as "namespace eval"):
      <code><pre>
      set name {};
      set i 0; time {set ns($i) [set name ${name}::namespace[incr i]]} 10000
      </pre></code>
      
      > pooryorick:
      <blockquote>It seems that the fully-qualified name of each created namespace is getting stored somewhere.</blockquote>
      
      Yes, see struct Namespace declaration "fullName" in tclInt.h.
      It is currently impossible without this member, because used everywhere and the auto-retrieving on demand would be admittedly possible, but will used almost immediately.
      
      I'll take a look later what would be possible to optimize it.
      
    2. login: "sebres"
    3. mimetype: "text/x-fossil-wiki"