Skip to content
Tcl Source Code Artifact [4f29842dd3]
Login

Artifact [4f29842dd3]

Artifact 4f29842dd38a7c4449686a8c24777b57479ce610:

Ticket change [4f29842dd3] - Ticket [32c5740a4d3e86b1|32c5740a4d] <i>Undesirable [lappend] performance as LIST_MAX is reached</i> status still Open with 3 other changes by dgp on 2015-11-23 20:52:27.
D 2015-11-23T20:52:27.535
J icomment \r\nLooking\ssome\smore,\swe\sfind\sthat\sTcl_ListObjReplace()\s\r\nis\sgetting\scalled\sbecause\sthe\sinstruction\s\r\nINST_LAPPEND_LIST_STK\sis\sdoing\sthe\swork.\sThis\sis\r\na\srecent\sinvention.\r\n\r\nTcl_ListObjReplace()\sis\snot\sthe\sonly\sroutine\sthat\sgrows\r\nlists.\sTcl_ListObjAppendElement()\salso\sdoes\sso,\sand\sis\r\na\smore\sdirect\simplementation\sto\suse\shere.\s\sThe\s\r\ninstructions\swe\sneed\sto\sget\sthat\sroutine\sworking\sfor\sus\sare\r\nINST_LAPPEND_SCALAR*\s\sThe\seasy\spath\sto\sthat\sis\sto\swrap\r\nthe\swhole\stest\sscript\sin\san\s[apply\s{{}\s{...}}]\r\n\r\nIndeed\sthis\sperforms\smuch\smuch\sbetter,\sgrowing\sup\sall\r\nthe\sway\sto\sthe\sLIST_MAX\slimit\sin\sthe\stime\sit\stakes\sthe\r\noriginal\sdemo\sto\sfill\sless\sthan\sthe\sfirst\s200M\selements.\r\n\r\nIt\sis\snot\shard\sto\smake\sthe\scompiler\suse\sINST_LAPPEND_SCALAR\r\ninstead\sof\sINST_LAPPEND_LIST_STK\sin\sthe\sdemonstrated\scase.\r\nThe\sproblem\sis\sthat\sthe\stwo\sinstructions\sexhibit\sdifferent\r\nbehaviors\sregarding\sread\straces,\sand\sthe\stest\ssuite\sis\snot\r\nhappy\swith\sthe\schange.\s\sThis\sis\sa\slong,\ssick,\ssad\stale.\sExplore\r\nif\syou\slike;\sit's\snot\spretty.\sWe've\sapparently\sdecided\sthe\sleast\r\nbad\soption\swe\shave\sis\sto\sleave\sthings\sinconsistent\sand\sbroken.\r\n\r\nThe\snext\sthing\sto\sexamine,\sthough,\sis\sjust\swhy\sTcl_ListObjAppendElement\r\ndoes\sso\smuch\sbetter\sthan\sTcl_ListObjReplace.\sThe\sanswer\sappears\sto\sbe\r\nthat\sthe\sformer\stakes\san\sextra\sstep\sin\sattempting\sto\suse\sthe\srealloc()\r\ncall\sof\sthe\smemory\sallocation\ssubsystem\sbefore\smoving\son\sto\sa\sfull\r\ncopy\sand\sextend.\s\sThe\scopies\sare\swhat\skills\sus\sin\sthe\stime,\sand\r\napparently\sin\sprecisely\sthis\sdemo\scase,\srealloc()\sis\sable\sto\sdo\swhat\r\nit\sexists\sto\sdo\s--\sgrow\sa\s(virutal)\smemory\sbuffer\swhile\savoiding\scopies\r\nas\smuch\sas\sit\scan.
J login dgp
J mimetype text/plain
K 32c5740a4d3e86b1973915d92f07d5aee6104a14
U dgp
Z bc77b1da3cbe7b3d5162d32024464313