summaryrefslogtreecommitdiffstats
path: root/tests-perf
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2024-03-21 10:31:56 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2024-03-21 10:31:56 (GMT)
commitcbce4bcf9f419d300baf4ff553be97adc49702fb (patch)
tree07f9dcf0d03a09b3810261d798c539ff98f29352 /tests-perf
parentab2ee17c917d4c1ac391bc15fe68a87e672f2f73 (diff)
parent8197ed757c03ffb91505685667a4d963923b3d22 (diff)
downloadtcl-cbce4bcf9f419d300baf4ff553be97adc49702fb.zip
tcl-cbce4bcf9f419d300baf4ff553be97adc49702fb.tar.gz
tcl-cbce4bcf9f419d300baf4ff553be97adc49702fb.tar.bz2
Merge 8.6
Diffstat (limited to 'tests-perf')
-rw-r--r--tests-perf/list.perf.tcl65
1 files changed, 41 insertions, 24 deletions
diff --git a/tests-perf/list.perf.tcl b/tests-perf/list.perf.tcl
index 9fde335..121a922 100644
--- a/tests-perf/list.perf.tcl
+++ b/tests-perf/list.perf.tcl
@@ -27,62 +27,79 @@ namespace path {::tclTestPerf}
proc test-lsearch-regress {{reptime 1000}} {
_test_run -no-result $reptime {
- # list with 5000 strings with ca. 50 chars elements:
+ # found-first immediately, list with 5000 strings with ca. 50 chars elements:
setup { set str [join [lrepeat 13 "XXX"] /]; set l [lrepeat 5000 $str]; llength $l }
- # lsearch with no option, found immediatelly :
+
{ lsearch $l $str }
- # lsearch with -glob, found immediatelly :
{ lsearch -glob $l $str }
- # lsearch with -exact, found immediatelly :
{ lsearch -exact $l $str }
- # lsearch with -dictionary, found immediatelly :
{ lsearch -dictionary $l $str }
+ { lsearch -exact -dictionary $l $str }
- # lsearch with -nocase only, found immediatelly :
{ lsearch -nocase $l $str }
- # lsearch with -nocase -glob, found immediatelly :
{ lsearch -nocase -glob $l $str }
- # lsearch with -nocase -exact, found immediatelly :
{ lsearch -nocase -exact $l $str }
- # lsearch with -nocase -dictionary, found immediatelly :
{ lsearch -nocase -dictionary $l $str }
+ { lsearch -nocase -exact -dictionary $l $str }
}
}
proc test-lsearch-nf-regress {{reptime 1000}} {
_test_run -no-result $reptime {
- # list with 5000 strings with ca. 50 chars elements:
+ # not-found, list with 5000 strings with ca. 50 chars elements:
setup { set str [join [lrepeat 13 "XXX"] /]; set sNF $str/NF; set l [lrepeat 5000 $str]; llength $l }
- # lsearch with no option, not found:
+
{ lsearch $l $sNF }
- # lsearch with -glob, not found:
{ lsearch -glob $l $sNF }
- # lsearch with -exact, not found:
{ lsearch -exact $l $sNF }
- # lsearch with -dictionary, not found:
{ lsearch -dictionary $l $sNF }
+ { lsearch -exact -dictionary $l $sNF }
+ { lsearch -sorted $l $sNF }
+ { lsearch -bisect $l $sNF }
+
+ { lsearch -nocase $l $sNF }
+ { lsearch -nocase -glob $l $sNF }
+ { lsearch -nocase -exact $l $sNF }
+ { lsearch -nocase -dictionary $l $sNF }
+ { lsearch -nocase -exact -dictionary $l $sNF }
+ { lsearch -nocase -sorted $l $sNF }
+ { lsearch -nocase -bisect $l $sNF }
}
}
-proc test-lsearch-nc-nf-regress {{reptime 1000}} {
+proc test-lsearch-nf-non-opti-fast {{reptime 1000}} {
_test_run -no-result $reptime {
- # list with 5000 strings with ca. 50 chars elements:
- setup { set str [join [lrepeat 13 "XXX"] /]; set sNF $str/NF; set l [lrepeat 5000 $str]; llength $l }
- # lsearch with -nocase only, not found:
+ # not-found, list with 5000 strings with ca. 50 chars elements:
+ setup { set str [join [lrepeat 13 "XXX"] /]; set sNF "$str/*"; set l [lrepeat 5000 $str]; llength $l }
+
+ { lsearch -sorted -dictionary $l $sNF }
+ { lsearch -bisect -dictionary $l $sNF }
+
+ { lsearch -sorted -nocase -dictionary $l $sNF }
+ { lsearch -bisect -nocase -dictionary $l $sNF }
+
+ }
+}
+
+proc test-lsearch-nf-non-opti-slow {{reptime 1000}} {
+ _test_run -no-result $reptime {
+ # not-found, list with 5000 strings with ca. 50 chars elements:
+ setup { set str [join [lrepeat 13 "XXX"] /]; set sNF "$str/*"; set l [lrepeat 5000 $str]; llength $l }
+
+ { lsearch $l $sNF }
+ { lsearch -glob $l $sNF }
+
{ lsearch -nocase $l $sNF }
- # lsearch with -nocase -glob, not found:
{ lsearch -nocase -glob $l $sNF }
- # lsearch with -nocase -exact, not found:
- { lsearch -nocase -exact $l $sNF }
- # lsearch with -nocase -dictionary, not found:
- { lsearch -nocase -dictionary $l $sNF }
+
}
}
proc test {{reptime 1000}} {
test-lsearch-regress $reptime
test-lsearch-nf-regress $reptime
- test-lsearch-nc-nf-regress $reptime
+ test-lsearch-nf-non-opti-fast $reptime
+ test-lsearch-nf-non-opti-slow $reptime
puts \n**OK**
}