.
D 2012-02-08T18:43:04
J assignee dgp
J cmimetype text/plain
J comment Hello,\s\n\nI've\sfound\sthat\sby\s"execution"\strace\ssome\sensemble\scommands\sproduce\sa\slot\sof\soverhead...\s\nwithout\strace\sit\sis\scomparable\swith\snot\sensemble\scommands\ni\shave\sown\sprofiler\s(to\scheck\swhich\scode\sworks\sslowly),\sthat\scalls\ssomthing\slike\sthis\s:\n\nTcl_CreateObjTrace(\sinterp,\slevel,\sTCL_ALLOW_INLINE_COMPILATION\s|\s((TCL_TRACE_ANY_EXEC)\s>>\s2),\n\s\s\s\s\s\s\s\s\s&tclexProfilerTraceProc,\sinDbgObj,\sNULL\s);\nThe\sC\sprocedure\s"tclexProfilerTraceProc"\si\shave\srewritten\sto\stest\sthis,\sthat\sit\sperforms\s"return\sTCL_OK;"\sonly.\n\nStrange\sis\sthe\sexecution\stimes\sof\s"string\slength"\sand\s"::tcl::string::length"\sare\snot\sdifferent,\s\nbut\s"string\srange"\sor\s"string\sfirst"\sare\s100\stimes\sslower\sas\sits\snot\sensemble\scommands\s"::tcl::string::range"\sor\s"::tcl::string::first".\n\nThat\soverhead\smake\sme\snot\spossible,\sto\sprofile\sanything\scode,\susing\sensembles.\n\nTcl\scode\sto\sbe\s"profiled":\n%%%%\nset\ss\s[string\srepeat\sA\s50000];\sputs\sok\nputs\s"---\sstring\srange\s----"\nputs\s[time\s{::tcl::string::range\s$s\s2000\s2001}\s100000]\nputs\s[time\s{::string\srange\s$s\s2000\s2001}\s10000]\nputs\s"---\sstring\sfirst\s----"\nputs\s[time\s{::tcl::string::first\sA\s$s\s2000}\s100000]\nputs\s[time\s{::string\sfirst\sA\s$s\s2000}\s10000]\nputs\s"---\sstring\slength\s---"\nputs\s[time\s{::tcl::string::length\s$s}\s100000]\nputs\s[time\s{::string\slength\s$s}\s10000]\nputs\s"---\stest\s------------"\nproc\s::test1_string_range\s{s\sfrom\sto}\s{set\sa\s5}\nproc\s::test2_string_range\s{ens\ss\sfrom\sto}\s{set\sa\s5}\nputs\s[time\s{::test1_string_range\s$s\s2000\s2001}\s10000]\nputs\s[time\s{::test2_string_range\srange\s$s\s2000\s2001}\s10000]\n%%%%\n\nResult\sis\s:\nok\n---\sstring\srange\s----\n1.4\smicroseconds\sper\siteration\n168.8\smicroseconds\sper\siteration\s!!!\n---\sstring\sfirst\s----\n1.09\smicroseconds\sper\siteration\n168.8\smicroseconds\sper\siteration\s!!!\n---\sstring\slength\s---\n0.31\smicroseconds\sper\siteration\n0.0\smicroseconds\sper\siteration\n---\stest\s------------\n1.6\smicroseconds\sper\siteration\n1.5\smicroseconds\sper\siteration\n
J foundin obsolete:\s8.5.11
J is_private 0
J priority 5\sMedium
J resolution None
J status Open
J submitter sebres
J subsystem 46.\sTraces
J title trace\s-\sinexplicable\slarge\soverhead\sby\sensemble\scommands
J type Bug
K 3485833fffffffffffffffffffffffffffffffff
U sebres
Z 9b2cb538e548d823b792e8911f292356