Skip to content
Tcl Source Code Artifact [9754a0737a]
Login

Artifact [9754a0737a]

Artifact 9754a0737a5413178415aab6330d85873ac58fa6214849642a18eb6a0235e144:

Ticket change [9754a0737a] - Ticket [6811a0081940b76c|6811a00819] <i>lsearch performance degradation on Tcl 8.6.11 release</i> status still Open with 3 other changes by sebres on 2024-03-20 15:51:29.
D 2024-03-20T15:51:29.001
J icomment My\sfew\scents\sfor\sthe\sissue:\r\n\r\n1.\sit\sseems\sto\saffect\s<b>-glob</b>\ssearch\s(as\sits\sdocu\ssays\s"If\soption\sis\somitted\sthen\sit\sdefaults\sto\s<b>-glob</b>"),\sso\sdefinitely\saffected\sby\schanges\sof\s<i>Tcl_StringCaseMatch</i>\setc.\r\n\r\n2.\sThe\sregression\sis\salso\sobvious\swith\smuch\ssimpler\stest,\shere\sas\sdiff\sbetween\scurrent\s8.6\sfrom\score-repo\sand\s8.6.9\s(no\sspeed\sdegradation),\sand\sit's\sas\scorrectly\sestimated\sabove\sindeed\s4x\sslower:\r\n\r\n<code><pre\sstyle="padding-left:10pt">\r\n\s\s%\stimerate\s-calibrate\s{}\r\n\s\s%\sset\sstr\s[join\s[lrepeat\s12\s"XXX"]\s/];\sset\sl\s[lrepeat\s5000\s$str];\sllength\s$l\r\n\s\s%\sproc\stest\s{}\s{global\sl\sstr;\stimerate\s{\slsearch\s$l\s$str/M\s}};\stest\r\n-\s2287.38\sµs/#\s438\s#\s437.18\s#/sec\s1001.874\snet-ms\r\n+\s546.060\sµs/#\s1832\s#\s1831.3\s#/sec\s1000.382\snet-ms\r\n\s\s%\sproc\stest\s{}\s{global\sl\sstr;\stimerate\s{\slsearch\s-exact\s$l\s$str/M\s}};\stest\r\n-\s8.060231\sµs/#\s123457\s#\s124065\s#/sec\s995.092\snet-ms\r\n+\s8.104484\sµs/#\s122794\s#\s123388\s#/sec\s995.182\snet-ms\r\n</pre></code>\r\n(as\sone\scan\ssee,\sthe\ssecond\smeasurement\swith\s<b>lsearch\s-exact</b>\sis\sindeed\snot\saffected.)\r\n\r\n3.\sViewing\sthe\sfound\scommit\s[26e57ca1486e497b],\sit\sis\sstriking\sthe\susage\sof\s\r\n<i>TclUtfToUCS4</i>\sinstead\sof\s<i>TclUtfToUniChar</i>\sen\smasse.\sHowever\s<i>TclUtfToUniChar</i>\swas\sa\smacro\s(quasi\sinline\sfunction),\swhere\s<i>TclUtfToUCS4</i>\sis\san\sinternal\sfunction\s(not\seven\sstatic,\sso\swouldn't\sbe\sinlined\sin\s-O2)\sand\sit\salso\sinternally\suses\s<i>Tcl_UtfToUniChar</i>\sin\sopposite\sto\s<i>TclUtfToUniChar</i>\s(with\sthe\ssame\sconsequences),\swhat\scan\stheoretically\sexplain\sthis\s2x\s+\s2x\sdegradation.\r\n\r\nI'll\stry\sto\sfix\sit\snow.
J login sebres
J mimetype text/x-fossil-wiki
K 6811a0081940b76c438c22c55d1d3ec7ddf622d1
U sebres
Z 82fb3245ddcc6bbd90cfc55414f15f8f