Tcl/Tk Benchmark Suite And Tools
Artifact Content
Not logged in
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2018 Conference, Houston/TX, US, Oct 15-19
Send your abstracts to tclconference@googlegroups.com
or submit via the online form by Aug 20.

Artifact 2d22d833648b85aa8ca3efa0a2962aa7e56a368e:



# Put data in a list
proc data-create-list {size} {
    for {set i 0} {$i < $size} {incr i} {
	lappend list $i
    }
}

# Put data in an array
proc data-create-array {size} {
    for {set i 0} {$i < $size} {incr i} {
	set array($i) $i
    }
}

# Access data in a list
proc data-access-list {listVar size} {
    upvar 1 $listVar list
    for {set i 0} {$i < $size} {incr i} {
	set bogus [lindex $list $i]
    }
}

# Access data in an array
proc data-access-array {arrayVar size} {
    upvar 1 $arrayVar array
    for {set i 0} {$i < $size} {incr i} {
	set bogus $array($i)
    }
}

set size 500
set list {}
for {set i 0} {$i < $size} {incr i} {
    lappend list $i
}

for {set i 0} {$i < $size} {incr i} {
    set array($i) $i
}

bench -desc "DATA create in a list" \
	-body {data-create-list $size}
bench -desc "DATA create in an array" \
	-body {data-create-array $size}

bench -desc "DATA access in a list" \
	-body {data-access-list list $size}
bench -desc "DATA access in an array" \
	-body {data-access-array array $size}