.
D 2005-07-28T16:11:31
J assignee nobody
J cmimetype text/plain
J comment Minor\soptimisation:\sthere\sare\sa\sfew\scalls\sto\s\nTcl_DStringAppend\swith\sfixed\sstrings,\sbut\sgive\sa\slength\s\nof\s-1.\sReplacing\sthe\s-1\swith\sthe\sactual\slength\s(as\sis\sdone\s\nin\sother\splaces)\swould\ssave\sa\sstrlen.\neg.\n\n\ntclConfig.c:141:\s\s\s\sTcl_DStringAppend\s\n(&cmdName,\s"::",\s\s\s\s\s\s\s\s\s\s-1);\ntclConfig.c:161:\s\s\s\sTcl_DStringAppend\s\n(&cmdName,\s"::pkgconfig",\s-1);\ntclInterp.c:433:\s\s\s\sTcl_DStringAppend(&script,\s"lsearch\s-\nexact",\s-1);\ntclInterp.c:437:\s\s\s\sTcl_DStringAppend(&script,\s"\s[file\sjoin\s\n[info\slibrary]\sencoding]",\s-1);\ntclInterp.c:450:\s\s\s\sTcl_DStringAppend(&script,\s"file\sjoin\s\n[info\slibrary]\sencoding",\s-1);\ntclUtil.c:1856:Tcl_DStringAppend(dsPtr,\s"\s{",\s-1);\ntclUtil.c:1858:Tcl_DStringAppend(dsPtr,\s"{",\s-1);\ntclUtil.c:1885:\s\s\s\sTcl_DStringAppend(dsPtr,\s"}",\s-1);\n\nThere\sare\salso\ssome\swhere\sthe\sstring\sbeing\scopied\sis\sa\s\nTcl_DString,\sso\swe\scould\suse\sthe\scorresponding\s\nTcl_DStringLength\sinstead\sof\s-1;\sagain\ssaving\sa\sstrlen.\n\neg.\n\ntclLoad.c:349:Tcl_DStringAppend(&initName,\s\nTcl_DStringValue(&pkgName),\s-1);\ntclLoad.c:351:Tcl_DStringAppend\n(&safeInitName,\sTcl_DStringValue(&pkgName),\s-1);\ntclLoad.c:353:\s\s\s\s\s\s\s\sTcl_DStringAppend(&unloadName,\s\nTcl_DStringValue(&pkgName),\s-1);\ntclLoad.c:355:\s\s\s\s\s\s\s\sTcl_DStringAppend\n(&safeUnloadName,\sTcl_DStringValue(&pkgName),\s-1);\ntclNamesp.c:823:Tcl_DStringAppend(&buffer1,\s\nTcl_DStringValue(&buffer2),\s-1);\ntclNamesp.c:826:Tcl_DStringAppend(&buffer2,\s\nTcl_DStringValue(&buffer1),\s-1);\n\n(which\smakes\sme\swonder\sif\sthe\sRight\sThing\sis\sdone\sif\s\nany\sof\sthe\sabove\scontain\sembedded\sNULs\sin\sthem,\sas\s\nthe\sstrlen\swill\sgive\sthe\s'incorrect'\slength.).\n\n\nFinal\spoint,\swouldn't\sthe\scopy\sloop\sin\sTcl_DStringAppend\s\nbe\squicker\sas\sa\smemcpy\sand\snot\sas\sa\scharacter\sby\s\ncharacter\scopy\sin\sthe\sfor\sloop.\sI've\sno\sempirical\sevidence,\s\njust\sthe\s(perhaps\sincorrect!)\sassumption\sthat\sthe\sC\s\nlibrary's\smemcpy\sis\squicker\sthan\sthe\scorresponding\sfor\s\nloop.\s\n\nCheers!
J foundin None
J priority 5\sMedium
J resolution None
J status Open
J submitter nobody
J subsystem None
J title Minor\soptimsations\sfor\sTcl_DStringAppend\susage.
J type Patch
K 1246897fffffffffffffffffffffffffffffffff
U nobody
Z 31e7a2104ada5062497faf8541d791ca