.
D 2004-02-24T22:07:40
J assignee msofer
J cmimetype text/plain
J comment \nIt's\sbeen\snoted\son\sthe\sWiki...\n\n\s\s\s\shttp://wiki.tcl.tk/9585\n\nthat\sthe\sruntime\sof\n\n\s\s\s\sexpr\s1[string\srepeat\s+1\s$N]\n\nis\squadratic\sin\s$N.\n\nThis\sis\sdue\sto\sTcl_ParseExpr().\nAfter\seach\s+\sis\sparsed\sin\s\nParseAddExpr(),\sa\scall\sis\smade\nto\sPrependSubExprTokens\sto\nshift\sthe\salready\sparsed\soperands\ndown\sthe\stoken\sarray\sto\smake\sroom\nfor\sthe\soperand\stoken\sat\sthe\sbeginning.\n\nThis\smeans\sthat\s$N\stimes,\s$n\stokens\nare\scopied\s(as\s$n\sgrows\sfrom\s1\sto\s$N)\njust\sto\sget\sthe\sparsing\sdone\s--\squadratic\ncomplexity.\n\nSimilar\sissues\sarise\swith\sother\sexpressions\nthat\scall\sPrependSubExprTokens.\n\nFor\smost\sshort\sexpressions,\sthis\spenalty\nhardly\smatters,\sbut\sa\smore\sscalable\sparser\nwould\sbe\snice.
J foundin None
J priority 5\sMedium
J resolution None
J status Open
J submitter dgp
J subsystem 45.\sParsing\sand\sEval
J title avoid\squadratic\sparsing\stime
J type RFE
K 903765ffffffffffffffffffffffffffffffffff
U dgp
Z 714ab1598cf2ba8c7dead7de503f31c4