|
2004-09-10
| ||
| 19:49 | • Closed ticket [924097ffff]: optimise {}-appends plus 7 other changes artifact: 1101827ea2 user: msofer | |
|
2004-03-29
| ||
| 17:40 | • Ticket [924097ffff]: 4 changes artifact: 024a93ea8b user: dkf | |
|
2004-03-27
| ||
| 02:06 | • Ticket [924097ffff]: 4 changes artifact: fa67a01475 user: dgp | |
|
2004-03-26
| ||
| 18:35 | • New ticket [924097ffff]. artifact: 384acb8223 user: msofer | |
optimise {}-appends
Closed / Accepted924097ffffffffffffffffffffffffffffffffffCreated 23 years agoUpdated 22 years ago
Descriptionplain2004-03-26 18:35:27
When appending to a Tcl_Obj, check first if the obj to
be appended is {}. In that case, return the untouched
original obj - avoid computing it's stringRep or
invalidating it's internalRep.
With this in place, the inline version of
K $x [set x {}]
can be written
$x[set x {}]
for greater performance.
Remark that this optimisation can be done at run time,
and also at compile time if the obj to be appended is
known to be {}. The compile time opt is however rather
involved - in the example above it would be possible in
principle (as 'set' is compiled, a redefinition will
trigger a recompilation of the whole script), but not in
$x[unset x]
dgpplain2004-03-27 02:06:48
Logged In: YES user_id=80530 the compiletime optimization is probably not possible, without some guarantee that there will not be a write trace on x at run time. (which might raise an error, or set a different, non-empty value).
dkfplain2004-03-29 17:40:18
Logged In: YES user_id=79902 Start by doing the runtime opt as that should be a safe peephole thing. Compile time optimisation is trickier because of the issues that DGP mentions, though I think there are ways round it. Those particular ideas of mine need more baking first though...
msoferplain2004-09-10 19:49:15
Logged In: YES user_id=148712 Peephole optimisation to INST_CONCAT1 commited.
Log in (anonymous is fine) to add a comment.