Skip to content
Tcl Source Code Artifact [6e2bd65927]
Login

Artifact [6e2bd65927]

Artifact 6e2bd65927e67a6643693b6dc62b5c770299d58a:

Ticket change [6e2bd65927] - Closed ticket [2873596fffffffff|2873596fff]: <i>Slowness in passing data through interp eval</i> plus 7 other changes by dgp on 2014-10-09 16:16:07.
D 2014-10-09T16:16:07.115
J closedate 2456940.17786013
J closer dgp
J comment I\swant\sto\sprocess\sdata\sreceived\sover\sthe\snetwork\sin\sa\ssafe\sinterpreter\s\r\n(although\sfor\sthe\spurposes\sof\sthis\squestion,\sthe\ssafe-ness\sis\s\r\nirrelevant).\sRoughly\sspeaking,\sI\sinvoke\sthe\ssafe\sinterpreter\sas\r\n\r\n\s\ssafeinterp\seval\s[list\sprocess_request\s$received_data]\r\n\r\nWhat\sI've\sfound\sis\sthat\sinvoking\sthe\sslave\sinterpreter\sin\sthis\smanner\sis\s\r\nslower\sthan\sprocessing\sin\sthe\ssame\sinterpreter\sby\stwo\sorders\sof\s\r\nmagnitude\sor\smore.\sHere\sis\sa\stkcon\ssession\ssimulating\sthe\sissue:\r\n\r\n(woof)\s51\s%\sinterp\screate\sip\r\nip\r\n(woof)\s52\s%\sip\seval\s{proc\sslaveproc\sarg\s{}}\r\n(woof)\s53\s%\sstring\slength\s[set\ss\s[string\srepeat\sx\s100000]]\r\n100000\r\n(woof)\s54\s%\stime\s{ip\seval\s[list\sslaveproc\s$s]}\s10\r\n3335.4\smicroseconds\sper\siteration\r\n\r\nSo\sroughly,\s3.3ms\sto\spass\s100K\sinto\san\sempty\sproc\sin\sthe\sslave.\sBy\s\r\ncomparison,\spassing\sit\sto\sa\sproc\sin\sthe\ssame\sinterp\s(using\seval\sfor\s\r\nconsistency)\r\n\r\n(woof)\s55\s%\sproc\smasterproc\sarg\s{}\r\n(woof)\s56\s%\stime\s{eval\s[list\smasterproc\s$s]}\s10\r\n9.3\smicroseconds\sper\siteration\r\n\r\nSo\suse\sof\sa\sslave\sinterpreter\sin\sthis\sfashion\sis\sMUCH\sslower.\r\n\r\nTimestamping\sthe\sC\scode,\sthe\sslowdown\swith\sthe\sslave\sinterp\sseems\sto\s\r\nhappen\sbecause\sof\sshimmering\sin\sSlaveEval\s(the\sinternal\srep\sfor\sthe\slist\s\r\nis\sthrown\saway\sand\sconverted\sto\sa\sstring\sand\sthen\sconverted\sback\sin\sthe\s\r\nslave).\r\n\r\nWorkaround\s-\sAlexander\sFerrieux\son\stcl-core\spointed\sout\sa\sworkaround.\sTo\squote\shim\s-\r\n----\r\nWhile\sI\sadmit\sI\sdon't\sfully\sunderstand\sthis\snecessity,\sit\sturns\sout\r\nthe\smultiple-argument\scode\spath\sdoesn't\shave\sthe\slimitation,\ssince\sit\r\ndirectly\scalls\s\sTcl_ConcatObj\son\sits\slist\sof\sarguments,\sand\sit\sis\swell\r\nknown\sthat\sTCO\sis\soptimized\sfor\sall-pure-list\sarguments\s(dating\sback\r\nto\sPaul\sDuffin's\swork\son\sConcat\sobjects\sIIRC).\sHence\sone\scan\sderive\sa\r\nscript-level\sidiom\sguaranteeing\sa\sshimmerless\spath:\r\n\r\n\s\s\s\s\s\sip\seval\s[list\sslaveproc]\s[list\s$s]\r\n-----\r\n\r\nI\salso\stested\swith\s8.5.2.\sIt\sis\sequally\sslow,\sand\swhat's\smore\sAlexander's\sworkaround\sdoes\snot\swork\sthere\s(it's\sstill\sslow),\spresumably\sbecause\sTcl_ConcatObj\sis\snot\soptimized\sin\s8.5.2\s(conjecture)\r\n\r\n\r\n/Ashok
J login dgp
J mimetype text/plain
J resolution Out\sof\sDate
J severity Minor
J status Closed
K 2873596fffffffffffffffffffffffffffffffff
U dgp
Z 01c1fb518b6df6738314ad19eeb2411d