Posted to tcl by patthoyts at Tue Jun 10 22:45:10 GMT 2008view pretty
% 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.