tclcompiler Code
Brought to you by:
aotto1968
#§ #§ CompPerf - tcl_unset.perf #§ #§ (C) IPN - Ingenieurbuero fuer Praezisionsnumerik #§ #§ Dipl.-Ing. Andreas Otto #§ Ulmenstrasse 3 #§ D-34289 Zierenberg #§ mailto:aotto@t-online.de #§ #§ Alle Rechte vorbehalten #§ package require PerfLib ## ## ----------------------------------------------------- ## the test-procs ## proc unset-1.1 {} { ## Unsetting an existing variable set i 0 unset i } proc unset-1.2 {} { ## Catching invalid unset set i 0 catch {unset j} } proc unset-1.3 {} { ## Catching valid unset set i 0 catch {unset i} } proc unset-1.4 {} { ## Testing existing variable before unset set i 0 if {[info exists i]} { unset i } } proc unset-1.5 {} { ## Testing non-existent variable before unset set i 0 if {[info exists j]} { unset j } } ## ## ----------------------------------------------------- ## make the test's ## set NUM [ ::PerfLib::Num 1000 ] set TOTAL [ time { ::PerfLib::Register unset-1.1 "Unsetting an existing variable" ::PerfLib::Run unset-1.1 [time {unset-1.1} $NUM] ::PerfLib::Register unset-1.2 "Catching invalid unset" ::PerfLib::Run unset-1.2 [time {unset-1.2} $NUM] ::PerfLib::Register unset-1.3 "Catching valid unset" ::PerfLib::Run unset-1.3 [time {unset-1.3} $NUM] ::PerfLib::Register unset-1.4 "Testing existing variable before unset" ::PerfLib::Run unset-1.4 [time {unset-1.4} $NUM] ::PerfLib::Register unset-1.5 "Testing non-existent variable before unset" ::PerfLib::Run unset-1.5 [time {unset-1.5} $NUM] } 1 ] ## ## ----------------------------------------------------- ## cleanup ## ::PerfLib::Exit