Artifacts Associated With Ticket 1990276
Ticket change [755e5e0ae2] (rid 105378) by patthoyts on 2008-06-10 23:10:41:
- assignee initialized to: "msofer"
- cmimetype initialized to: "text/plain"
- comment initialized to:
I'm testing out adding a state option to the binary encode functions to make it simpler to write channels that use these functions. The -state option takes a variable name. In the C code we therefore get a bytearray object passed in via the objv array and may also get another object passed via name. I get a 10x faster calling time using the pass-by-name. % proc t1 {} {variable data; binary encode hex $data} % proc t2 {} {variable data; binary encode hex -state data ""} % set data [binary format @102400] ; string length [t1] 204800 % set data [binary format @102400] ; string length [t2] 204800 % set data [binary format @102400] ; time {t1} 10 1755.9 microseconds per iteration % set data [binary format @102400] ; time {t2} 10 218.6 microseconds per iteration !!!!! The C function accesses these Tcl_Obj's using: data = input = Tcl_GetByteArrayFromObj(objv[objc-1], &count); if (stateObj) { data = state = Tcl_GetByteArrayFromObj(stateObj, &state_count); count += state_count; } and then I move the 'data' pointer along the state data first then the input data. So the C code is identical for each calling method. You can see the full function at http://paste.tclers.tk/973 - foundin initialized to: "obsolete: 8.6a0"
- is_private initialized to: "0"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "patthoyts"
- subsystem initialized to: "07. Variables"
- title initialized to: "Surprising differences in variable access speed."
- type initialized to: "Bug"
Ticket change [db8449028c] (rid 107975) by msofer on 2008-06-12 03:49:25:
- closedate changed to: "2008-06-11T20:49:25"
- closer changed to: "msofer"
- icomment:
Logged In: YES user_id=148712 Originator: NO This is a bug in the interpretation of the timing script: [t2] will reset $data to {} after the first run, so that the remaining 9 runs are done on empty data. Proper timing gives % proc t1 {} {variable data; binary encode hex $data} % proc t2 {} {variable data; binary encode hex -state data ""} % set data0 [binary format @102400]; string length $data0 102400 % time {set data $data0; t1} 10 1032.5 microseconds per iteration % time {set data $data0; t2} 1010 microseconds per iteration - login: "msofer"
- mimetype: "text/plain"
- resolution changed to: "Rejected"
- status changed to: "Closed"
- username: "msofer"