Artifacts Associated With Ticket 466037ffffffffff
Ticket change [c12620ff6b] (rid 111277) by msofer on 2001-09-28 13:35:33:
- assignee initialized to: "msofer"
- cmimetype initialized to: "text/plain"
- comment initialized to:
Let the compiler recognise the idioms [lindex $list 0] ;# get the head of $list and [lrange $list 1 end] ;# get the tail of $list and compile-in optimised code for them. The idea is to make the list operations usual in functional programming very efficient. This follows a discussion started in c.l.t. by Acacio Cruz - the thread does not yet show up in google, I will add the reference as soon as available.
- foundin initialized to: "None"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "msofer"
- subsystem initialized to: "47. Bytecode Compiler"
- title initialized to: "Optimise getting the head/tail of a list"
- type initialized to: "RFE"
Ticket change [d7ec75f743] (rid 107352) by msofer on 2001-09-28 21:51:27:
- icomment:
Logged In: YES user_id=148712 The clt thread is at http://groups.google.com/groups?hl=en&threadm=3BB3F8D8.51932A75%40eur.autodesk.com&prev=/groups%3Foi%3Ddjq%26as_ugroup%3Dcomp.lang.tcl
- login: "msofer"
- mimetype: "text/plain"
- username: "msofer"
- icomment:
Ticket change [91366f3d7f] (rid 120587) by hobbs on 2001-09-29 01:51:47:
- icomment:
Logged In: YES user_id=72656 Note that lindex is already about as optimized as can be in the byte-code compiler. lrange could be worked on.
- login: "hobbs"
- mimetype: "text/plain"
- username: "hobbs"
- icomment:
Ticket change [2110133ec6] (rid 130521) by mdejong on 2001-09-29 01:57:17:
- icomment:
Logged In: YES user_id=90858 Is supporting lisp like recursion really that important? It seems like the foreach command is far better than list like recursion any day of the week.
- login: "mdejong"
- mimetype: "text/plain"
- username: "mdejong"
- icomment:
Ticket change [8877e28507] (rid 131872) by msofer on 2001-09-29 02:01:54:
- icomment:
Logged In: YES user_id=148712 The idea was to recognize at compile time that the index to [lindex] is an integer, so that the call to TclGetIntForIndex can be avoided at runtime. In this sense, head can be improved - I do not really know how much of a difference it will make.
- login: "msofer"
- mimetype: "text/plain"
- username: "msofer"
- icomment:
Ticket change [8e533293e9] (rid 120097) by andreas_kupries on 2001-09-29 05:27:31:
- icomment:
Logged In: YES user_id=75003 Note that optimizing 'end', 'end-1' is harder than for '0', '1', etc. The index cannot be transmitted to the lindex bytecode as a simple number (behaviour for negative numbers is defined, return the empty string). This requires an additional 'index' objtype which can represent static indices from the end.
- login: "andreas_kupries"
- mimetype: "text/plain"
- username: "andreas_kupries"
- icomment:
Ticket change [1b5a67c1da] (rid 123133) by hobbs on 2001-09-29 05:45:59:
- icomment:
Logged In: YES user_id=72656 Sure it can - just pass a negative number. If you are handling immediates, you get to define your own syntax, and allow negative numbers. This would have been easier all along (instead of the end-x), but people perceived that to be a compatability problem.
- login: "hobbs"
- mimetype: "text/plain"
- username: "hobbs"
- icomment:
Ticket change [03dbfdc4de] (rid 119899) by andreas_kupries on 2001-09-29 06:40:37:
- icomment:
Logged In: YES user_id=75003 So [lindex $foo -1] just pushes an empty object, [lindex $foo end-1] passes index '-1' to the bytecode and [lindex $foo $idx] compiles to something which goes through TclGetForIndex ? Could work.
- login: "andreas_kupries"
- mimetype: "text/plain"
- username: "andreas_kupries"
- icomment:
Ticket change [d27780674c] (rid 113532) by msofer on 2001-10-01 19:13:01:
- icomment:
Logged In: YES user_id=148712 A small change to Andreas' description, to allow the representation of "end" ('-0'?): let '-1' stand for 'end', so that the previous description becomes: So [lindex $foo -1] just pushes an empty object, [lindex $foo end-1] passes index '-2' to the bytecode and [lindex $foo $idx] compiles to something which goes through TclGetForIndex ? Could work. - login: "msofer"
- mimetype: "text/plain"
- username: "msofer"
- icomment:
Ticket change [f550fecb92] (rid 130084) by kennykb on 2001-10-03 22:28:56:
- assignee changed to: "kennykb"
- icomment:
Logged In: YES user_id=99768 The changes I'm working on for TIP #22 already have a Tcl_ObjType for 'end-' indices. Note that Tcl_GetIntForIndex should be extremely fast if the index is constant because the first couple of lines of code check for 'int' and 'index' objtypes, and the string rep is examined only if both those checks fail. We may at some point want to revisit what happens for [lindex $list end-$i], but that's farther out. For what it's worth, what's compiled for [lindex $list $i], with $list and $i both local, is INST_LOAD_SCALAR1 <var # for list> INST_LOAD_SCALAR1 <var # for i> INST_LIST_INDEX For [lindex $list 0], it'll be INST_LOAD_SCALAR1 <var # for list> INST_PUSH1 <literal # for 0> INST_LIST_LINDEX INST_LIST_LINDEX does indeed call TclGetIntForIndex, but that's been changed to begin with looking for tclIntType and tclEndOffsetType and not do any parsing if the object is already a known type. Let's see how that does on the benchmarks before we try to squeeze any more out of it. - login: "kennykb"
- mimetype: "text/plain"
- username: "kennykb"
Ticket change [7475c51a20] (rid 105208) by kennykb on 2001-11-21 00:34:45:
- closedate changed to: "2001-11-20T17:34:45"
- closer changed to: "kennykb"
- icomment:
Logged In: YES user_id=99768 Just spoke with the originator, and he says that "he requested feature has been provided."
- login: "kennykb"
- mimetype: "text/plain"
- status changed to: "Closed"
- username: "kennykb"