Posted to tcl by de at Thu Jan 26 23:35:29 GMT 2017view pretty

proc stack_after_idle {howmuch} {
    for {set i 0} {$i < $howmuch} {incr i} {
        after idle {
            # Do something.
            set foo bar
        }
    }
}

foreach howmuch {
    10000
    20000
    40000
    60000
} {
    stack_after_idle $howmuch
    set start [clock milliseconds]
    update
    puts "$howmuch: [expr {[clock milliseconds] - $start}]"
}