Tcl Source Code

View Ticket
Login
Ticket UUID: 441372
Title: Adding constants in ExecEnv
Type: Patch Version: None
Submitter: msofer Created on: 2001-07-15 00:42:01
Subsystem: 47. Bytecode Compiler Assigned To: msofer
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2005-04-05 21:12:27
Resolution: Out of Date Closed By: msofer
    Closed on: 2005-04-05 14:12:27
Description:
The patch defines 4 "constant" Tcl_Obj in the execution
environment: "zero", "one", "minus one" and "empty
object".
The purpose is to avoid some unnecessary object
creation/destruction, especially of boolean values.

There is a zero-to-minimal positive effect in tclbench
results; it may be larger for threaded builds.
User Comments: msofer added on 2005-04-05 21:12:27:
Logged In: YES 
user_id=148712

Parts of this have been incorporated into 8.5a3

hobbs added on 2002-06-20 05:42:51:
Logged In: YES 
user_id=72656

pushing this back to miguel due to the number of changes he 
has made to TEBC recently.

msofer added on 2001-09-14 22:56:14:
Logged In: YES 
user_id=148712

Mhh ... the idiom is actually
  foreach $varNameList {{}} break
which sets the variables whose names are in $varNameList to
the empty object {}

msofer added on 2001-07-17 18:40:17:
Logged In: YES 
user_id=148712

I do not expect a large memory effect either: most of the
things that are changed involve relatively short lived
Tcl_Obj. Boolean values for instance are typically consumed
right after creation.

One exception could be when setting large numbers of
variables to {} via the idiom
   foreach varName $someList {.} break
which sets the first variable to "." and the rest per
default to {}. This idiom is used in both implementations of
set operations in the wiki (soon in tcllib and tclbench?),
(see http://mini.net/tcl/271.html).

hobbs added on 2001-07-17 01:50:49:
Logged In: YES 
user_id=72656

My guess is this has minor benchmark effects because it 
only minorly affect small obj allocations.  However, it may 
be a more notable effect on mem usage (any good ways to 
check that in a practical manner?).

Anyway, this should be run through purify or efence before 
getting commited.

msofer added on 2001-07-15 07:51:16:

File Added - 8426: patch.txt

msofer added on 2001-07-15 07:42:02:

File Added - 8425: bench.const3

Attachments: