Skip to content
Tcl Source Code Artifact [1e3fd1839e]
Login

Artifact [1e3fd1839e]

Artifact 1e3fd1839e3db55eb48cbc84788fc7133132cd0e:

Ticket change [1e3fd1839e] - Ticket [3485833fffffffff|3485833fff] <i>trace - inexplicable large overhead by ensemble commands</i> status still Open with 6 other changes by sebres on 2017-01-04 14:25:01.
D 2017-01-04T14:25:01.760
J closer nobody
J comment Hello,\s\r\n\r\nI've\sfound\sthat\sby\s"execution"\strace\ssome\sensemble\scommands\sproduce\sa\slot\sof\soverhead...\s\r\nwithout\strace\sit\sis\scomparable\swith\snot\sensemble\scommands\r\ni\shave\sown\sprofiler\s(to\scheck\swhich\scode\sworks\sslowly),\sthat\scalls\ssomthing\slike\sthis\s:\r\n\r\nTcl_CreateObjTrace(\sinterp,\slevel,\sTCL_ALLOW_INLINE_COMPILATION\s|\s((TCL_TRACE_ANY_EXEC)\s>>\s2),\r\n\s\s\s\s\s\s\s\s\s&tclexProfilerTraceProc,\sinDbgObj,\sNULL\s);\r\nThe\sC\sprocedure\s"tclexProfilerTraceProc"\si\shave\srewritten\sto\stest\sthis,\sthat\sit\sperforms\s"return\sTCL_OK;"\sonly.\r\n\r\nStrange\sis\sthe\sexecution\stimes\sof\s"string\slength"\sand\s"::tcl::string::length"\sare\snot\sdifferent,\s\r\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".\r\n\r\nThat\soverhead\smake\sme\snot\spossible,\sto\sprofile\sanything\scode,\susing\sensembles.\r\n\r\nTcl\scode\sto\sbe\s"profiled":\r\n%%%%\r\nset\ss\s[string\srepeat\sA\s50000];\sputs\sok\r\nputs\s"---\sstring\srange\s----"\r\nputs\s[time\s{::tcl::string::range\s$s\s2000\s2001}\s100000]\r\nputs\s[time\s{::string\srange\s$s\s2000\s2001}\s10000]\r\nputs\s"---\sstring\sfirst\s----"\r\nputs\s[time\s{::tcl::string::first\sA\s$s\s2000}\s100000]\r\nputs\s[time\s{::string\sfirst\sA\s$s\s2000}\s10000]\r\nputs\s"---\sstring\slength\s---"\r\nputs\s[time\s{::tcl::string::length\s$s}\s100000]\r\nputs\s[time\s{::string\slength\s$s}\s10000]\r\nputs\s"---\stest\s------------"\r\nproc\s::test1_string_range\s{s\sfrom\sto}\s{set\sa\s5}\r\nproc\s::test2_string_range\s{ens\ss\sfrom\sto}\s{set\sa\s5}\r\nputs\s[time\s{::test1_string_range\s$s\s2000\s2001}\s10000]\r\nputs\s[time\s{::test2_string_range\srange\s$s\s2000\s2001}\s10000]\r\n%%%%\r\n\r\nResult\sis\s:\r\nok\r\n---\sstring\srange\s----\r\n1.4\smicroseconds\sper\siteration\r\n168.8\smicroseconds\sper\siteration\s!!!\r\n---\sstring\sfirst\s----\r\n1.09\smicroseconds\sper\siteration\r\n168.8\smicroseconds\sper\siteration\s!!!\r\n---\sstring\slength\s---\r\n0.31\smicroseconds\sper\siteration\r\n0.0\smicroseconds\sper\siteration\r\n---\stest\s------------\r\n1.6\smicroseconds\sper\siteration\r\n1.5\smicroseconds\sper\siteration
J icomment Interim\sstatus\sof\ssubject:\r\n\r\nEven\swithout\sany\stracing,\scurrent\strunk\shave\sstill\svery\slarge\soverhead,\sthat\sconcerns\sto\sensemble\shandling\s(by\sthe\sway,\sgreater\sthan\sin\s8.5).\s\r\nIt\scould\sbe\sbetter\sexplained\susing\smy\snew\scommand\s"timerate"\s(fairly\smore\sprecise\sby\smeasurement\sas\sthe\s"time"),\scurrently\savailable\sfor\strunk-based\sbranches\sin\shttps://github.com/sebres/tcl/pull/3\r\n\r\nFollowing\sexample\swill\sprovide\syou\sinsight\sabout\sensemble-overhead\s(compiled\sas\swell\sas\snon-compiled\sexecution\stakes\sby\sensemble\s70%\smore\stime):\r\n\r\n```\r\n%\sset\ss\s[string\srepeat\sA\s50000];\sputs\sok\r\nok\r\n%\s#\scalibrate\sto\sminimize\sinfluence\sof\smeasurement\soverhead\s(and\sbyte\scode\sexecution\soverhead):\r\n\r\n%\stimerate\s-calibrate\s{}\r\n0.04537374883248807\sµs/#-overhead,\s0.045506\sµs/#,\s42895062\s#,\s21974929\s#/sec\r\n\r\n%\s#\stest\scompiled\sexecution:\r\n%\stimerate\s{string\sfirst\sA\s$s\s2000}\r\n0.321560\sµs/#,\s2725287\s#,\s3109837\s#/sec\r\n%\stimerate\s{::tcl::string::first\sA\s$s\s2000}\r\n0.191541\sµs/#,\s4220926\s#,\s5220810\s#/sec\r\n\r\n%\s#\scalibrate\sagain\s(slower,\snon-compiled\sdirect\sexecution\svia\sTclEvalObjEx):\r\n%\stimerate\s-direct\s-calibrate\s{}\r\n0.07950384713110215\sµs/#-overhead,\s0.080109\sµs/#,\s24366669\s#,\s12482924\s#/sec\r\n\r\n%\stimerate\s-direct\s{string\sfirst\sA\s$s\s2000}\r\n0.313794\sµs/#,\s2542604\s#,\s3186803\s#/sec\r\n%\stimerate\s-direct\s{::tcl::string::first\sA\s$s\s2000}\r\n0.190985\sµs/#,\s3697004\s#,\s5236000\s#/sec\r\n```
J login sebres
J mimetype text/plain
J severity Minor
K 3485833fffffffffffffffffffffffffffffffff
U sebres
Z b31b21b98042031382dabaca325b1252