Artifacts Associated With Ticket 1890831fffffffffffffffffffffffffffffffff
Ticket change [e6c433289d] (rid 104346) by ferrieux on 2008-02-10 23:30:16:
- assignee initialized to: "dkf"
- cmimetype initialized to: "text/plain"
- comment initialized to:
The attached patch against 8.5.1 is a cleanup of the [lrange] implementation, including: - use of T_LOL to stick to the style of other list ops, instead of a complex and unique anti-shimmering share-intrep mechanism dedicated to a rare and already fast case [lrange $x $x $x]. - flattening of if-return's to stick to the style of other list ops, improving readability. - detection of unshared case to operate in-place, by calling twice Tcl_ListObjReplace (in correct order). The first two points are just a matter of style, but allow for the third, which is a pretty significant optimization. Measurements on a 100-million list [lrepeat 100000000 1]: [lrange ... 1 end] in-place gives a 3x speedup [lrange ... 0 end-1] in-place gives a 24000x speedup -Alex % set l [lrepeat 100000000 1];llength $l 100000000 % time {set l [lrange $l 1 end];llength $l} 814663 microseconds per iteration % proc K { x y } {set x} % time {set l [lrange [K $l [unset l]] 1 end];llength $l} 272517 microseconds per iteration % set l [lrepeat 100000000 1];llength $l 100000000 % time {set l [lrange $l 0 end-1];llength $l} 815985 microseconds per iteration % set l [lrepeat 100000000 1];llength $l 100000000 % time {set l [lrange [K $l [unset l]] 0 end-1];llength $l} 34 microseconds per iteration - foundin initialized to: "None"
- is_private initialized to: "0"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "ferrieux"
- subsystem initialized to: "17. Commands I-L"
- title initialized to: "Lrange cleanup and in-place optimization"
- type initialized to: "Patch"
Add attachment "lrange_cleanup.patch" [c36bca0499] (rid 111657) by ferrieux on 2008-02-11 06:30:17.
Ticket change [c16c9bcf04] (rid 111317) by ferrieux on 2008-02-11 06:30:18:
- icomment:
File Added - 265796: lrange_cleanup.patch
- login: "ferrieux"
- mimetype: "text/plain"
- username: "ferrieux"
- icomment:
Ticket change [128b18629d] (rid 124050) by dgp on 2008-02-12 00:40:23:
- icomment:
Logged In: YES user_id=80530 Originator: NO The patch intrudes a bit into the internal rep of the "list" Tcl_ObjType with the cast to (List *). I'd like a slight refactoring better where that code got moved into tclListObj.c as some internal routine called by Tcl_LrangeObjCmd(). Just a preference to put as much of the code needing to know about "list" intReps over in tclListObj.c as we can. Not a requirement, but something nice to do. I know we're not "pure" by that measure currently. It's about preference and direction. Might be interesting to try the K-free K as well: lrange $l[unset l] 0 end-1
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Ticket change [c39f761fbb] (rid 111695) by ferrieux on 2008-02-12 01:51:11:
- icomment:
Logged In: YES user_id=496139 Originator: YES About the needed refactoring to avoid (List *), please notice that I stole it from Tcl_LreverseObjCmd, right in the same file, and that half a dozen other places in tclCmdIL.c directly reach into Lists. So, I suggest either to leave it that way, or to clean everything up at the same time (slight preference for the former). Your choice ? Also, thanks for the K-free K trick. I was really amazed to see $l"" not shimmer to pure-string; has this optimization of concat existed for long ?
- login: "ferrieux"
- mimetype: "text/plain"
- username: "ferrieux"
- icomment:
Ticket change [cfb936e269] (rid 113037) by dgp on 2008-02-12 03:05:22:
- icomment:
Logged In: YES user_id=80530 Originator: NO dkf can make the call whether he wants any changes before committing.
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Ticket change [583f26f1e5] (rid 117769) by ferrieux on 2008-04-29 20:30:49:
- assignee changed to: "msofer"
- icomment:
Logged In: YES user_id=496139 Originator: YES Miguel, again throwing this one to you in the hope of reducing the pressure on Donal's shoulders... Tell me if you prefer otherwise.
- login: "ferrieux"
- mimetype: "text/plain"
- username: "ferrieux"
Ticket change [4edea24fa4] (rid 125721) by msofer on 2008-06-28 22:47:58:
- assignee changed to: "ferrieux"
- icomment:
Logged In: YES user_id=148712 Originator: NO This looks OK for commit to HEAD; Alex, please do. It would be nice to insure that the testsuite covers any possible gotcha (although I cannot thing of any right now). It'd be also nice to check if tclbench will expose the improvement, and to write a small bench to include there if not.
- login: "msofer"
- mimetype: "text/plain"
- username: "msofer"
Ticket change [a0644802cd] (rid 96805) by ferrieux on 2008-06-30 06:25:24:
- icomment:
Logged In: YES user_id=496139 Originator: YES Committed to HEAD. Will be preparing test and tclbench cases from now on. Leaving this open as a reminder.
- login: "ferrieux"
- mimetype: "text/plain"
- username: "ferrieux"
- icomment:
Ticket change [e8fe637a4c] (rid 104733) by ferrieux on 2008-07-24 06:23:44:
- closedate changed to: "2008-07-23T23:23:44"
- closer changed to: "ferrieux"
- icomment:
Logged In: YES user_id=496139 Originator: YES Test suite updated with a relative speed test.
- login: "ferrieux"
- mimetype: "text/plain"
- status changed to: "Closed"
- username: "ferrieux"