summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2024-03-21 10:33:18 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2024-03-21 10:33:18 (GMT)
commit2ffbe54c20f058377c1a6ebb30f783ec148c6dfe (patch)
treebeb15d0d1e85bd65f30f542487335401456bdca3
parente9d501fca085dc074f6873aa80907fdf29fdeea0 (diff)
parent38ded2e1fa7208cc9acbcf2a50e4ab7871175c2d (diff)
downloadtcl-2ffbe54c20f058377c1a6ebb30f783ec148c6dfe.zip
tcl-2ffbe54c20f058377c1a6ebb30f783ec148c6dfe.tar.gz
tcl-2ffbe54c20f058377c1a6ebb30f783ec148c6dfe.tar.bz2
Merge 8.7
-rw-r--r--generic/tclTest.c2
-rw-r--r--tests-perf/list.perf.tcl65
2 files changed, 42 insertions, 25 deletions
diff --git a/generic/tclTest.c b/generic/tclTest.c
index c0ce8db..bbadf72 100644
--- a/generic/tclTest.c
+++ b/generic/tclTest.c
@@ -3927,7 +3927,7 @@ TestlistrepCmd(
listRepObjs[3] = Tcl_NewListObj(8, NULL);
Tcl_ListObjAppendElement(interp, listRepObjs[3],
Tcl_NewStringObj("memoryAddress", -1));
- Tcl_ListObjAppendElement(interp, listRepObjs[3],
+ Tcl_ListObjAppendElement(interp, listRepObjs[3],
Tcl_ObjPrintf("%p", listRep.spanPtr));
APPEND_FIELD(listRepObjs[3], listRep.spanPtr, spanStart);
APPEND_FIELD(listRepObjs[3], listRep.spanPtr, spanLength);
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**
}