<i>TIP 280: compiled [switch] performance impact</i> status still Open with 5 other changes
by
.
D 2007-04-03T01:24:01
J assignee dgp
J icomment Logged\sIn:\sYES\s\nuser_id=75003\nOriginator:\sNO\n\nAttached\sa\stest\sscript\scontaining\sthe\soriginal\sp\sproc,\sand\sa\sq\sproc\susing\s'-exact\s--'.\sMy\sresults\sare:\n\n8.5a6\np/match\s\s\s7.96166\smicroseconds\sper\siteration\np/!match\s\s2.14355\smicroseconds\sper\siteration\nq/match\s\s\s1.34635\smicroseconds\sper\siteration\nq/!match\s\s1.35886\smicroseconds\sper\siteration\n\n8.4.15\np/match\s\s\s1.94189\smicroseconds\sper\siteration\np/!match\s\s1.98629\smicroseconds\sper\siteration\nq/match\s\s\s2.01993\smicroseconds\sper\siteration\nq/!match\s\s2.07895\smicroseconds\sper\siteration\n\nA\sslow\sdown\sin\sthe\smatching\scase\sfor\sp,\sbut\snot\sfor\sq\s(-exact\s--).\nCurrent\stheory\sregarding\sthis\sslowdown:\n\nIn\s'q',\sdue\sto\sthe\suse\sof\s'-exact\s--'\sthe\sswitch\scommand\sis\sdeeply\sbyte-compiled,\sincluding\sthe\sbranches.\sThis\skeeps\sit\sfast.\sHowever\sin\s'p'\sthe\sgenerated\sbyte\scode\sfalls\sback\sto\sthe\sregular\scommand\simplementation,\swhich\s'eval's\sthe\sfound\sbranch.\sDue\s#280\sthis\seval\sis\snow\sslower.\sThe\snon-matching\scase\sis\sstill\sas\sfast\sbecause\sno\sbranch\sis\sfound,\si.e.\sthere\sis\sno\sslow\seval,\sit\sis\sskipped.\sDoes\sthat\smake\ssense\s?\n\nTo\stest\sthe\stheory\sI\sdisabled\sthe\scode\sin\slines\s2933ff\sand\s3002ff\sin\stclCmdMZ.c\s...\sThe\stime\sfor\sp/match\swent\sdown\sto\s8.4.15\slevels.\sRefining\sthis\sfurther\sI\sam\scoming\sto\sthe\sconclusion\sthat\sthe\smain\scause\sis\sthe\scall\sto\s'TclListLines'\sin\sline\s2962.\sIn\sother\swords,\sit\sis\snot,\sas\stheorized,\sthe\seval\swhich\sis\sthe\sproblem,\sbut\sthe\sfact\sthat\swe\shave\sto\sreparse\sthe\sswitch\sbody\sargument\sto\sdetermine\sthe\sline\sthe\sfound\sbranch\sis\sstarting\son/at.\sAnd\swe\sdo\sthis\severy\stime\sthe\sswitch\sexecuted.\n\nOur\soptions\sto\shandle\sthis\sare:\n\n(1)\sRepeal\sall\sof\s#280.\n(2)\sFind\sa\sway\sto\scache\sthe\sresult\sof\sthe\s'TclListLines'\sso\sthat\sthe\sparsing\sis\sdone\sonly\sonce,\sand\sfurther\sexecutions\sof\sthe\ssame\sswitch\suse\sthe\scached\sinformation.\n(3)\sFind\sa\sway\sto\sdefer\sthe\s'TclListLines',\si.e.\sinstead\sof\sdoing\sit\simmediately\sdo\sit\sonly\swhen\sneeded,\si.e.\swhen\sthe\sinformation\sis\sasked\sfor.\n\nNo\s#1\sis\snot\svery\sappealing,\sas\swe\swould\sloose\sthe\swhole\sfunctionality.\nNo\s#3\sis\sconceptually\sthe\smost\selegant\sIMVHO,\sbut\simplementation\swise\sI\salready\ssee\sproblems.\sBecause\sthe\sEvalObjEx\sof\sthe\sswitch\sbranch\swill\scount\sline\snumbers\sand\sfor\sthat\sit\swill\sneed\sthe\sline\sthe\sbranch\sis\sat.\sI.e.\sthe\sdeferal\sis\snot\svery\sfar.\sIt\swould\swork\sonly\sif\sthe\sEvalEx\scounts\srelative\sand\screates\sanother\sstructure\sX\s=\s<base,relative-line>,\swhere\s<base>\sis\sthe\sdefered\scomputation,\sand\sX\scan\sbe\sdefered\stoo.\sThat\scan\sbecome\svery\scomplex\sto\smanage.\nNo\s#2\sis\sconceptually\snot\svery\selegant,\si.e.\sit\sfeels\smore\shackish.\scompared\sto\s#3\sits\simplementation\sshould\showever\sbe\smuch\seasier.\sWe\s'only'\sneed\sa\sway\sto\sassociate\sthe\s'TclListLines'\sresult\swith\s(a)\sthe\sswitch,\sor\s(b)\sthe\sswitch\sbody\slist.\sMaybe\sa\shashtable\skeyed\sby\sthe\saddress\sof\sthe\sswitch\sbody\sobject.\sWhich\sis\sa\sliteral,\snot\smoving\saround\s...\sThis\sis\sthe\ssame\sidea\sas\sused\sfor\sthe\sbyte\scodes,\ssee\sthe\s'lineBCPtr'\shash\stable.\n\nRe-assigning\sto\sdgp\sfor\sreview\sof\smy\scomments\sand\sideas.\sDon,\sfeel\sfree\sto\sassign\sto\sDonal\sas\swell\sfor\san\sopinion,\sgiven\sthat\sswitch\sis\shis.\sWell,\sat\sleast\sthe\sBC\scompiler\spart.\n
J login andreas_kupries
J mimetype text/plain
J username andreas_kupries
K 1692378fffffffffffffffffffffffffffffffff
U andreas_kupries
Z 4174fff80d4225291ab1766ead7cfb88