.
D 2009-10-06T17:39:20
J assignee hobbs
J cmimetype text/plain
J comment I\swant\sto\sprocess\sdata\sreceived\sover\sthe\snetwork\sin\sa\ssafe\sinterpreter\s\n(although\sfor\sthe\spurposes\sof\sthis\squestion,\sthe\ssafe-ness\sis\s\nirrelevant).\sRoughly\sspeaking,\sI\sinvoke\sthe\ssafe\sinterpreter\sas\n\n\s\ssafeinterp\seval\s[list\sprocess_request\s$received_data]\n\nWhat\sI've\sfound\sis\sthat\sinvoking\sthe\sslave\sinterpreter\sin\sthis\smanner\sis\s\nslower\sthan\sprocessing\sin\sthe\ssame\sinterpreter\sby\stwo\sorders\sof\s\nmagnitude\sor\smore.\sHere\sis\sa\stkcon\ssession\ssimulating\sthe\sissue:\n\n(woof)\s51\s%\sinterp\screate\sip\nip\n(woof)\s52\s%\sip\seval\s{proc\sslaveproc\sarg\s{}}\n(woof)\s53\s%\sstring\slength\s[set\ss\s[string\srepeat\sx\s100000]]\n100000\n(woof)\s54\s%\stime\s{ip\seval\s[list\sslaveproc\s$s]}\s10\n3335.4\smicroseconds\sper\siteration\n\nSo\sroughly,\s3.3ms\sto\spass\s100K\sinto\san\sempty\sproc\sin\sthe\sslave.\sBy\s\ncomparison,\spassing\sit\sto\sa\sproc\sin\sthe\ssame\sinterp\s(using\seval\sfor\s\nconsistency)\n\n(woof)\s55\s%\sproc\smasterproc\sarg\s{}\n(woof)\s56\s%\stime\s{eval\s[list\smasterproc\s$s]}\s10\n9.3\smicroseconds\sper\siteration\n\nSo\suse\sof\sa\sslave\sinterpreter\sin\sthis\sfashion\sis\sMUCH\sslower.\n\nTimestamping\sthe\sC\scode,\sthe\sslowdown\swith\sthe\sslave\sinterp\sseems\sto\s\nhappen\sbecause\sof\sshimmering\sin\sSlaveEval\s(the\sinternal\srep\sfor\sthe\slist\s\nis\sthrown\saway\sand\sconverted\sto\sa\sstring\sand\sthen\sconverted\sback\sin\sthe\s\nslave).\n\nWorkaround\s-\sAlexander\sFerrieux\son\stcl-core\spointed\sout\sa\sworkaround.\sTo\squote\shim\s-\n----\nWhile\sI\sadmit\sI\sdon't\sfully\sunderstand\sthis\snecessity,\sit\sturns\sout\nthe\smultiple-argument\scode\spath\sdoesn't\shave\sthe\slimitation,\ssince\sit\ndirectly\scalls\s\sTcl_ConcatObj\son\sits\slist\sof\sarguments,\sand\sit\sis\swell\nknown\sthat\sTCO\sis\soptimized\sfor\sall-pure-list\sarguments\s(dating\sback\nto\sPaul\sDuffin's\swork\son\sConcat\sobjects\sIIRC).\sHence\sone\scan\sderive\sa\nscript-level\sidiom\sguaranteeing\sa\sshimmerless\spath:\n\n\s\s\s\s\s\sip\seval\s[list\sslaveproc]\s[list\s$s]\n-----\n\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)\n\n\n/Ashok
J foundin obsolete:\s8.6b1.1
J is_private 0
J priority 5\sMedium
J resolution None
J status Open
J submitter apnadkarni
J subsystem 20.\s[interp]
J title Slowness\sin\spassing\sdata\sthrough\sinterp\seval
J type Bug
K 2873596fffffffffffffffffffffffffffffffff
U apnadkarni
Z 3435342b2a69bd474924c6bf2cfde17f