Skip to content
Tcl Source Code History Of Ticket 3163961fffffffff
Login

History Of Ticket 3163961fffffffff

Artifacts Associated With Ticket 3163961fffffffff

  1. Ticket change [3f42f21d4d] (rid 121428) by twylite on 2011-01-22 15:48:09:

    1. assignee initialized to: "dkf"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      "mapeach" is a collecting [foreach], and arises from a discussion at http://wiki.tcl.tk/26013 .  This patch provides an implementation of [mapeach] in the core, with full bytecoding support, leveraging the existing [foreach] infrastructure.
      
      
    4. foundin initialized to: "None"
    5. is_private initialized to: "0"
    6. priority initialized to: "5 Medium"
    7. resolution initialized to: "None"
    8. status initialized to: "Open"
    9. submitter initialized to: "twylite"
    10. subsystem initialized to: "16. Commands A-H"
    11. title initialized to: "mapeach implementation with bytecoding"
    12. type initialized to: "Patch"
  2. Add attachment "mapeach.patch" [b0e6d2d807] (rid 98059) by twylite on 2011-01-22 22:48:09.

  3. Ticket change [b5d7578898] (rid 125318) by twylite on 2011-01-22 22:48:10:

    1. icomment:
      
      
      File Added - 399513: mapeach.patch
      
      
      
    2. login: "twylite"
    3. mimetype: "text/plain"
    4. username: "twylite"
  4. Add attachment "mapeach.test" [783e3ee331] (rid 89926) by twylite on 2011-01-22 22:50:04.

  5. Ticket change [64b120ced2] (rid 92813) by twylite on 2011-01-22 22:50:04:

    1. icomment:
      
      
      File Added - 399514: mapeach.test
      
      
      
    2. login: "twylite"
    3. mimetype: "text/plain"
    4. username: "twylite"
  6. Ticket change [5abebc3024] (rid 118199) by twylite on 2011-01-22 22:50:46:

    1. icomment:
      Includes a full set up tests (partially derived from the foreach.test suite).
      
      
    2. login: "twylite"
    3. mimetype: "text/plain"
    4. username: "twylite"
  7. Ticket change [ee4fdfd326] (rid 104060) by twylite on 2012-07-31 20:37:04:

    1. icomment:
      
      
      File Added - 450233: td-3163961-2.patch
      
      
      
    2. login: "twylite"
    3. mimetype: "text/plain"
    4. username: "twylite"
  8. Add attachment "td-3163961-2.patch" [12ec935394] (rid 124132) by twylite on 2012-07-31 20:37:04.

  9. Ticket change [0053c4ba9d] (rid 119302) by dkf on 2012-08-02 16:31:42:

    1. foundin changed to: "TIP Implementation"
    2. title changed to: "TIP 405: mapeach implementation with bytecoding"
  10. Ticket change [e16437c45b] (rid 87437) by twylite on 2012-08-02 18:55:26:

    1. icomment:
      
      
      File Added - 450402: td-3163961-3.patch
      
      
      
    2. login: "twylite"
    3. mimetype: "text/plain"
    4. username: "twylite"
  11. Add attachment "td-3163961-3.patch" [eba50c4c10] (rid 103571) by twylite on 2012-08-02 18:55:26.

  12. Ticket change [24c49b1216] (rid 131165) by twylite on 2012-08-02 19:32:29:

    1. icomment:
      # Performance tests
      # Tcl = 32-bit tclsh86t.exe from trunk [19174445] with branches bug-3545363
      #       and td-mapeach merged in, built with MSVC10, OPTS=threads
      # Platform = Intel64 (AMD64) i5 @ 2.67Ghz running Windows 7 (64-bit)
      
      set d [lsearch -all [lrepeat 1000000 x] x] ; llength $d
      
      lindex $d 1000 ;# ensure list rep
      
      time {
      set accum {}
      foreach {k v} $::d {
        lappend accum [expr { $k * $v }]
      }
      puts [tcl::mathop::+ {*}$accum] ;# 166666416666500000
      }
      # 750919 microseconds per iteration (foreach)
      
      time {
      puts [tcl::mathop::+ {*}[mapeach {k v} $::d { expr { $k * $v } }]] ;# 166666416666500000
      }
      # 616432 microseconds per iteration (mapeach)
      
      time { 
      apply {{} {
      set accum {}
      foreach {k v} $::d {
        lappend accum [expr { $k * $v }]
      }
      puts [tcl::mathop::+ {*}$accum] ;# 166666416666500000
      }}
      }
      # 382724 microseconds per iteration (apply foreach)
      
      time {
      apply {{} {
      puts [tcl::mathop::+ {*}[mapeach {k v} $::d { expr { $k * $v } }]] ;# 166666416666500000
      }}
      }
      # 382829 microseconds per iteration (apply mapeach)
      
      dict get $d 1000 ;# ensure dict rep
      
      time {
      set accum {}
      dict for {k v} $::d {
        lappend accum [expr { $k * $v }]
      }
      puts [tcl::mathop::+ {*}$accum] ;# 166666416666500000
      }
      # 739547 microseconds per iteration (dict for)
      
      time {
      puts [tcl::mathop::+ {*}[dict map {k v} $::d { expr { $k * $v } }]] ;# 166666416666500000
      }
      # 621000 microseconds per iteration (dict map)
      
      time { 
      apply {{} {
      set accum {}
      dict for {k v} $::d {
        lappend accum [expr { $k * $v }]
      }
      puts [tcl::mathop::+ {*}$accum] ;# 166666416666500000
      }}
      }
      # 357713 microseconds per iteration (apply dict for)
      
      time {
      apply {{} {
      puts [tcl::mathop::+ {*}[dict map {k v} $::d { expr { $k * $v } }]] ;# 166666416666500000
      }}
      }
      # 360457 microseconds per iteration (apply dict map)
      
      RANK:
      # 357713 microseconds per iteration (apply dict for)
      # 360457 microseconds per iteration (apply dict map)
      # 382724 microseconds per iteration (apply foreach)
      # 382829 microseconds per iteration (apply mapeach)
      # 616432 microseconds per iteration (mapeach)
      # 621000 microseconds per iteration (dict map)
      # 739547 microseconds per iteration (dict for)
      # 750919 microseconds per iteration (foreach)
      
      
      
    2. login: "twylite"
    3. mimetype: "text/plain"
    4. username: "twylite"
  13. Ticket change [b6ce2e6308] (rid 125479) by twylite on 2012-08-03 23:55:19:

    1. icomment:
      Latest implementation committed to branch 'tip-405-impl-td'.  This includes 'mapeach' and 'dict map' with full test suites, a bug fix made since the last patchfile, and man pages.
      
      Also included is an experimental accumulating foreach tentatively named 'foreacha'.  [foreacha] treats the first list variable as an accumulator.  The accumulator consumes a list element on the first iteration only, and is returned by [foreacha].
      
      Examples of [foreacha]:
      
      fold with initial var: foreacha a 0 b {1 2 3 4} { incr a $b }
      fold without initial var: foreacha {a b} {1 2 3 4} { incr a $b }
      filter: foreacha a {} b {1 2 3 4} { if { ($b % 2)==0 } { lappend a $b } }
      map: foreacha a {} b {1 2 3 4} { lappend a [expr { $b * 5 }] }
      prefix: foreacha a {} b {1 2 3 4} { if { $b > 2 } break; lappend a $b }
      
      
      
    2. login: "twylite"
    3. mimetype: "text/plain"
    4. username: "twylite"
  14. Ticket change [1b1d1ebea5] (rid 133382) by dkf on 2013-08-20 10:21:54:

    1. closedate changed to: "2456524.9318784"
    2. closer changed to: "dkf"
    3. comment changed to:
      "mapeach" is a collecting [foreach], and arises from a discussion at http://wiki.tcl.tk/26013 .  This patch provides an implementation of [mapeach] in the core, with full bytecoding support, leveraging the existing [foreach] infrastructure.
      
    4. icomment:
      Variation of this incorporated into 8.6 as <tt>lmap</tt>.
      
    5. login: "dkf"
    6. mimetype: "text/html"
    7. resolution changed to: "Accepted"
    8. severity changed to: "Minor"
    9. status changed to: "Closed"
    10. username: "dkf"