Automatic Value Deduplication in the Tcl Core
-or-
Tcl_?NewStringObj Caching by the Core

Cyan Ogilvie
Ruby Lane, Inc.
cyan@rubylane.com

Motivation

  • For certain workloads, allocating new Tcl_Objs makes up a large part of the execution time

Scope

  • Experiment intended to assess the implementation cost and potential benefits
  • Throw-away: not intended to be TIPed in its current form

Approach

  • Create caching versions of Tcl_NewStringObj and TclNewStringObj
    • Small cache of Tcl_Objs: a few hundred entries
    • Only attempt to cache strings less than 16 characters
    • Store the cached Tcl_Objs in a Tcl_HashTable keyed by the string
    • Use a cheap cache aging scheme so that frequently and recently used strings stay in the cache, but infrequently used strings are quickly evicted

How Much Duplication Is There Anyway?

Cache stats immediately after startup of an interactive tclsh:

Calls Entries Hits Misses Hit Rate
1,025 289 271 420 39%
filters          [  4] hits:      1, heat:   2, types: pure string
unknown          [  5] hits:      1, heat:   0, types: pure string
current          [  2] hits:      1, heat:   2, types: pure string
cyan             [  5] hits:      3, heat:   2, types: pure string
seconds          [  4] hits:      1, heat:   1, types: pure string
exists           [  7] hits:     25, heat:  22, types: pure string
xim              [  4] hits:      1, heat:   1, types: pure string
join             [  2] hits:     72, heat:  73, types: pure string
::oo::InfoObject [  4] hits:      1, heat:   2, types: list
which            [  2] hits:      5, heat:   6, types: pure string
8.6.7            [  3] hits:      2, heat:   2, types: pure string
format           [  4] hits:      2, heat:   1, types: pure string
length           [  2] hits:      7, heat:   8, types: pure string
tail             [  4] hits:      1, heat:   0, types: pure string
![llength $args] [  2] hits:      1, heat:   2, types: pure string
name             [  2] hits:      1, heat:   2, types: pure string
/home/cyan       [  3] hits:      1, heat:   1, types: pure string
flush            [  4] hits:      1, heat:   0, types: pure string
system           [  4] hits:      1, heat:   0, types: pure string
-20              [  2] hits:      1, heat:   2, types: pure string
/                [  2] hits:     26, heat:  27, types: pure string
0                [  2] hits:      1, heat:   2, types: pure string
1                [  7] hits:      4, heat:   2, types: pure string
unset            [  4] hits:      2, heat:   1, types: pure string
base64           [  4] hits:      1, heat:   0, types: pure string
tcl_interactive  [  4] hits:      1, heat:   2, types: parsedVarName
mixins           [  4] hits:      1, heat:   2, types: pure string
uuencode         [  4] hits:      1, heat:   0, types: pure string
env              [  2] hits:      4, heat:   5, types: parsedVarName
dirname          [  2] hits:      2, heat:   3, types: pure string
threaded         [  4] hits:      1, heat:   1, types: pure string
map              [  4] hits:      1, heat:   0, types: pure string
match            [  4] hits:      2, heat:   1, types: pure string
::oo::InfoClass  [  4] hits:      1, heat:   2, types: list
size             [  5] hits:      3, heat:   1, types: pure string
ubuntu           [  6] hits:      3, heat:   2, types: pure string
set              [  4] hits:      2, heat:   1, types: pure string
$ret != 0        [  2] hits:      1, heat:   2, types: pure string
oldest           [  3] hits:      1, heat:   2, types: pure string
script           [  2] hits:      1, heat:   2, types: pure string
TCL_LIBRARY      [  3] hits:      3, heat:   3, types: pure string
gnome-session    [  4] hits:      1, heat:   1, types: pure string
dirs             [  2] hits:      1, heat:   2, types: pure string
POSIX            [  2] hits:      2, heat:   3, types: pure string
copy             [  4] hits:      1, heat:   0, types: pure string
ENOENT           [  2] hits:      2, heat:   3, types: pure string
Unity            [  4] hits:      1, heat:   1, types: pure string
$exec eq ""      [  2] hits:      1, heat:   2, types: pure string
methods          [  4] hits:      1, heat:   2, types: pure string
delete           [  4] hits:      2, heat:   1, types: index
trim             [  2] hits:      1, heat:   2, types: pure string
cmd              [  2] hits:      1, heat:   2, types: pure string
replace          [  4] hits:      1, heat:   0, types: pure string
methodtype       [  4] hits:      1, heat:   2, types: pure string
ibus             [  4] hits:      1, heat:   1, types: pure string
get              [  4] hits:      4, heat:   3, types: pure string
add              [  4] hits:      2, heat:   2, types: pure string
append           [  2] hits:      1, heat:   2, types: pure string
nextid           [  4] hits:      2, heat:   3, types: pure string
keep             [  4] hits:      2, heat:   3, types: pure string
scan             [  4] hits:      2, heat:   1, types: pure string
Dir              [  2] hits:      1, heat:   2, types: parsedVarName
variables        [  4] hits:      1, heat:   2, types: pure string
bytelength       [  2] hits:      1, heat:   2, types: pure string
last             [  2] hits:      3, heat:   4, types: pure string
incr             [  2] hits:      4, heat:   5, types: pure string
range            [  2] hits:      6, heat:   7, types: pure string
TCLLIBPATH       [  3] hits:      2, heat:   2, types: pure string
definition       [  4] hits:      1, heat:   1, types: pure string
eval             [  5] hits:      7, heat:   6, types: pure string
commands         [  2] hits:      1, heat:   2, types: pure string
call             [  4] hits:      1, heat:   1, types: pure string
create           [  6] hits:      2, heat:   1, types: pure string
level            [  2] hits:      2, heat:   3, types: pure string
::fconfigure     [  4] hits:      1, heat:   0, types: list
longest          [  2] hits:      1, heat:   2, types: pure string
names            [  5] hits:      2, heat:   0, types: pure string
hex              [  4] hits:      1, heat:   0, types: pure string
tcl_platform     [  3] hits:     10, heat:   5, types: parsedVarName
20               [  3] hits:      1, heat:   2, types: pure string
forward          [  4] hits:      1, heat:   2, types: pure string
class            [  4] hits:      1, heat:   1, types: pure string
						

How Much Duplication Is There Anyway?

package require http
package require platform
platform::identify
clock scan [clock format [clock seconds]]
Calls Entries Hits Misses Hit Rate
2,639 368 1,183 736 62%
filters          [  4] hits:      1, heat:   0, types: pure string
LANG             [  3] hits:      3, heat:   2, types: pure string
$cpu eq "amd64"  [  2] hits:      0, heat:   0, types: pure string
ev               [  2] hits:      1, heat:   0, types: pure string
 $mm eq {}       [  2] hits:      1, heat:   2, types: pure string
swt              [  3] hits:      0, heat:   0, types: pure string
44               [  2] hits:      1, heat:   2, types: int
.so              [  2] hits:      2, heat:   1, types: pure string
MT               [  2] hits:      0, heat:   1, types: string
jst              [  3] hits:      0, heat:   0, types: pure string
Nov              [  3] hits:      0, heat:   1, types: pure string
current          [  2] hits:      7, heat:   5, types: pure string
cyan             [  5] hits:      3, heat:   0, types: pure string
mcfolder         [  4] hits:      1, heat:   1, types: pure string
 $s eq {}        [  2] hits:      1, heat:   2, types: pure string
dump             [  2] hits:      0, heat:   1, types: pure string
opts             [  2] hits:      5, heat:   6, types: pure string
wast             [  3] hits:      0, heat:   0, types: pure string
seconds          [  4] hits:      4, heat:   2, types: pure string
exists           [  7] hits:     87, heat:  47, types: pure string
eest             [  3] hits:      0, heat:   0, types: pure string
 $nLeap != 0     [  2] hits:      1, heat:   2, types: pure string
file3            [  2] hits:      0, heat:   1, types: channel
 $t < $lastTime  [  2] hits:      1, heat:   2, types: pure string
%H:%M:%S         [  5] hits:      2, heat:   1, types: string
EST              [  3] hits:      1, heat:   2, types: string
Aug              [  3] hits:      0, heat:   1, types: pure string
Feb              [  3] hits:      0, heat:   1, types: pure string
LMT              [  4] hits:      1, heat:   2, types: string
UnknownPending   [  2] hits:      1, heat:   0, types: pure string
Tue              [  3] hits:      0, heat:   1, types: pure string
$version eq "2"  [  2] hits:      1, heat:   2, types: pure string
 $nType > 255    [  2] hits:      1, heat:   2, types: pure string
gst              [  3] hits:      0, heat:   0, types: pure string
join             [  2] hits:    112, heat:  30, types: pure string
::oo::InfoObject [  4] hits:      1, heat:   0, types: list
cast             [  3] hits:      0, heat:   0, types: pure string
which            [  2] hits:      8, heat:   4, types: pure string
$t > $lastTime   [  2] hits:      1, heat:   2, types: pure string
PM               [  3] hits:      0, heat:   0, types: pure string
value            [  2] hits:      2, heat:   2, types: pure string
path             [  2] hits:      3, heat:   1, types: pure string
 $dstName eq {}  [  2] hits:      1, heat:   2, types: pure string
Sat              [  3] hits:      0, heat:   1, types: pure string
                 [  2] hits:      4, heat:   5, types: pure string
%I:%M:%S %P      [  3] hits:      0, heat:   0, types: string
$ret == 0        [  2] hits:      0, heat:   0, types: pure string
normalize        [  2] hits:      6, heat:   2, types: pure string
8.6.7            [  3] hits:     15, heat:   4, types: string
format           [  4] hits:      3, heat:   0, types: pure string
tail             [  2] hits:      1, heat:   1, types: pure string
length           [  2] hits:     12, heat:   5, types: pure string
is               [  2] hits:      1, heat:   2, types: pure string
PT               [  2] hits:      0, heat:   1, types: string
tolower          [  2] hits:     13, heat:   9, types: pure string
%                [  2] hits:      7, heat:   8, types: pure string
it               [  3] hits:      0, heat:   0, types: pure string
pattern          [  2] hits:      0, heat:   0, types: pure string
ix86             [  2] hits:      0, heat:   0, types: pure string
-12              [  2] hits:      1, heat:   2, types: int
equal            [  2] hits:      1, heat:   2, types: pure string
*::*             [  2] hits:      0, heat:   0, types: pure string
![llength $args] [  2] hits:      1, heat:   0, types: pure string
inscope          [  2] hits:      0, heat:   0, types: pure string
name             [  2] hits:      2, heat:   1, types: pure string
changecmd        [  4] hits:      1, heat:   1, types: pure string
*                [  2] hits:      3, heat:   1, types: pure string
MONTHS_FULL      [  3] hits:      0, heat:   0, types: pure string
EACCES           [  2] hits:      1, heat:   0, types: pure string
!$didLocaleEra   [  2] hits:      1, heat:   2, types: pure string
jt               [  3] hits:      0, heat:   0, types: pure string
-20              [  2] hits:      1, heat:   0, types: pure string
/                [  2] hits:    112, heat:  32, types: pure string
cat              [  3] hits:      0, heat:   0, types: pure string
ast              [  3] hits:      0, heat:   0, types: pure string
Linux            [  3] hits:      0, heat:   0, types: pure string
0                [  2] hits:      1, heat:   0, types: pure string
1                [  7] hits:      4, heat:   0, types: pure string
LOCALE_ERAS      [  3] hits:      0, heat:   0, types: pure string
2                [  2] hits:      0, heat:   0, types: pure string
base             [  2] hits:      0, heat:   0, types: pure string
CLOCK            [  2] hits:      3, heat:   4, types: pure string
6                [  2] hits:      1, heat:   2, types: int
 $m eq {}        [  2] hits:      1, heat:   2, types: pure string
unset            [  6] hits:     23, heat:  16, types: pure string
Mar              [  3] hits:      0, heat:   1, types: pure string
%EC%Ey           [  3] hits:      0, heat:   0, types: string
dest             [  2] hits:      0, heat:   0, types: pure string
:                [  3] hits:      4, heat:   5, types: string
preferences      [  3] hits:      0, heat:   0, types: pure string
 $doy ne {}      [  2] hits:      1, heat:   2, types: pure string
TCL              [  2] hits:      5, heat:   2, types: pure string
	BIND-8.2.3-T5B  [  2] hits:      0, heat:   0, types: pure string
$cpu eq "ix86"   [  2] hits:      0, heat:   0, types: pure string
May              [  3] hits:      0, heat:   1, types: pure string
ST               [  2] hits:      1, heat:   2, types: string
::msgcat::mcload [  2] hits:      0, heat:   0, types: string
Sep              [  3] hits:      0, heat:   1, types: pure string
tcl_interactive  [  4] hits:      1, heat:   0, types: parsedVarName
mixins           [  4] hits:      1, heat:   0, types: pure string
Jan              [  3] hits:      0, heat:   1, types: pure string
ydt              [  3] hits:      0, heat:   0, types: pure string
%H:%M            [  3] hits:      0, heat:   0, types: string
cct              [  3] hits:      0, heat:   0, types: pure string
C                [  2] hits:      1, heat:   2, types: pure string
$item in $list1  [  2] hits:      0, heat:   0, types: pure string
 $y >= 39        [  2] hits:      1, heat:   2, types: pure string
loadcmd          [  4] hits:      1, heat:   1, types: pure string
::               [  2] hits:      3, heat:   1, types: nsName
list             [  3] hits:      1, heat:   0, types: pure string
retval           [  2] hits:      1, heat:   2, types: pure string
eadt             [  3] hits:      0, heat:   0, types: pure string
H                [  2] hits:      0, heat:   1, types: pure string
env              [  2] hits:      7, heat:   2, types: localVarName
cdt              [  3] hits:      0, heat:   0, types: pure string
M                [  2] hits:      0, heat:   1, types: pure string
nst              [  3] hits:      0, heat:   0, types: pure string
[llength $args]  [  2] hits:      0, heat:   1, types: pure string
INDEX            [  2] hits:      5, heat:   2, types: pure string
dirname          [  2] hits:     12, heat:   3, types: pure string
ns               [  2] hits:      1, heat:   1, types: pure string
pa               [  2] hits:      1, heat:   0, types: pure string
nt               [  3] hits:      0, heat:   0, types: pure string
"" eq $cmd       [  2] hits:      0, heat:   0, types: pure string
S                [  2] hits:      0, heat:   1, types: pure string
 $week >= 0      [  2] hits:      1, heat:   2, types: pure string
ensemble         [  2] hits:      1, heat:   0, types: pure string
 $dowim >= 5     [  2] hits:      1, heat:   2, types: pure string
T                [  2] hits:      5, heat:   6, types: string
cet              [  3] hits:      0, heat:   0, types: pure string
DATE_TIME_FORMAT [  3] hits:      0, heat:   0, types: pure string
unknowncmd       [  4] hits:      1, heat:   1, types: pure string
qualifiers       [  2] hits:      1, heat:   1, types: pure string
$len == 1        [  2] hits:      0, heat:   0, types: pure string
ia64*            [  2] hits:      1, heat:   1, types: pure string
map              [  4] hits:     41, heat:  38, types: pure string
CPT              [  3] hits:      1, heat:   2, types: string
nzst             [  3] hits:      0, heat:   0, types: pure string
Y                [  2] hits:      0, heat:   1, types: pure string
Z                [  2] hits:      0, heat:   1, types: pure string
kst              [  3] hits:      0, heat:   0, types: pure string
keys             [  2] hits:      4, heat:   2, types: pure string
pm               [  3] hits:      0, heat:   0, types: pure string
match            [  4] hits:      8, heat:   2, types: pure string
cest             [  3] hits:      0, heat:   0, types: pure string
TIME_FORMAT      [  3] hits:      0, heat:   0, types: pure string
LC_ALL           [  3] hits:      0, heat:   0, types: pure string
 $ss eq {}       [  2] hits:      1, heat:   2, types: pure string
::oo::InfoClass  [  4] hits:      1, heat:   0, types: list
a                [  3] hits:      3, heat:   3, types: pure string
b                [  3] hits:      1, heat:   1, types: pure string
WT               [  2] hits:      0, heat:   1, types: string
size             [  2] hits:      1, heat:   2, types: pure string
c                [  3] hits:      4, heat:   5, types: pure string
import           [  2] hits:      3, heat:   2, types: pure string
ubuntu           [  6] hits:      3, heat:   0, types: pure string
d                [  3] hits:      1, heat:   2, types: pure string
set              [  4] hits:     96, heat:  90, types: pure string
e                [  3] hits:      0, heat:   1, types: pure string
$ret < 2         [  2] hits:      0, heat:   0, types: pure string
$ret != 0        [  2] hits:      1, heat:   0, types: pure string
f                [  3] hits:      0, heat:   1, types: pure string
g                [  3] hits:      0, heat:   1, types: pure string
hst              [  3] hits:      0, heat:   0, types: pure string
::msgcat::mc     [  2] hits:      0, heat:   0, types: string
"" eq $ns        [  2] hits:      0, heat:   0, types: pure string
en_ZA.UTF-8      [  3] hits:      2, heat:   1, types: string
h                [  3] hits:      0, heat:   1, types: pure string
pdt              [  3] hits:      0, heat:   0, types: pure string
$nscur != ""     [  2] hits:      0, heat:   1, types: pure string
i                [  3] hits:      0, heat:   1, types: pure string
j                [  2] hits:      3, heat:   2, types: pure string
k                [  3] hits:      0, heat:   1, types: pure string
oldest           [  3] hits:      1, heat:   0, types: pure string
l                [  3] hits:      0, heat:   1, types: pure string
m                [  3] hits:      0, heat:   1, types: pure string
library          [  2] hits:      1, heat:   0, types: pure string
script           [  2] hits:      3, heat:   1, types: pure string
n                [  3] hits:      1, heat:   1, types: pure string
toupper          [  2] hits:      3, heat:   4, types: pure string
o                [  3] hits:      0, heat:   1, types: pure string
TCL_LIBRARY      [  3] hits:      3, heat:   0, types: pure string
p                [  3] hits:      5, heat:   2, types: pure string
q                [  3] hits:      0, heat:   1, types: pure string
2000             [  2] hits:      1, heat:   2, types: int
1900             [  2] hits:      1, heat:   2, types: int
flag             [  2] hits:      1, heat:   2, types: pure string
%%               [  4] hits:      1, heat:   2, types: string
CST              [120] hits:      1, heat:   2, types: string
r                [  3] hits:      0, heat:   1, types: pure string
dirs             [  2] hits:      1, heat:   0, types: pure string
s                [  3] hits:      0, heat:   1, types: pure string
POSIX            [  2] hits:      4, heat:   1, types: pure string
Dec              [  3] hits:      0, heat:   1, types: pure string
t                [  3] hits:      2, heat:   3, types: pure string
est              [  3] hits:      0, heat:   0, types: pure string
B.C.E.           [  3] hits:      0, heat:   0, types: pure string
u                [  3] hits:      0, heat:   1, types: pure string
mdt              [  3] hits:      0, heat:   0, types: pure string
loc              [  2] hits:      1, heat:   2, types: pure string
\:               [  3] hits:      2, heat:   3, types: string
v                [  3] hits:      0, heat:   1, types: pure string
w                [  3] hits:      0, heat:   1, types: pure string
Wed              [  3] hits:      0, heat:   1, types: pure string
%+               [  3] hits:      0, heat:   1, types: string
x                [  3] hits:      0, heat:   1, types: pure string
nameofexecutable [  2] hits:      2, heat:   0, types: pure string
y                [  3] hits:      0, heat:   1, types: pure string
isdirectory      [  2] hits:      1, heat:   1, types: pure string
ENOENT           [  2] hits:      2, heat:   0, types: pure string
 $z < 0          [  2] hits:      1, heat:   2, types: pure string
z                [  3] hits:      0, heat:   1, types: pure string
loclist          [  3] hits:      0, heat:   0, types: pure string
$exec eq ""      [  2] hits:      1, heat:   0, types: pure string
utc              [  3] hits:      0, heat:   0, types: pure string
methods          [  4] hits:      1, heat:   0, types: pure string
met              [  3] hits:      0, heat:   0, types: pure string
::tcl::clock     [  8] hits:     51, heat:  34, types: nsName
bst              [  3] hits:      0, heat:   0, types: pure string
TIME_FORMAT_12   [  3] hits:      0, heat:   0, types: pure string
jdt              [  3] hits:      0, heat:   0, types: pure string
BCE              [  3] hits:      0, heat:   0, types: pure string
 $z != 0         [  2] hits:      1, heat:   2, types: pure string
wat              [  3] hits:      0, heat:   0, types: pure string
trim             [  2] hits:      1, heat:   0, types: pure string
result           [  2] hits:      3, heat:   4, types: pure string
wadt             [  3] hits:      0, heat:   0, types: pure string
$timezone eq ""  [  2] hits:      1, heat:   2, types: pure string
 $s eq {-}       [  2] hits:      1, heat:   2, types: pure string
MONTHS_ABBREV    [  3] hits:      0, heat:   0, types: pure string
nzt              [  3] hits:      0, heat:   0, types: pure string
TIME_FORMAT_24   [  3] hits:      0, heat:   0, types: pure string
cmd              [  2] hits:      2, heat:   0, types: pure string
$magic ne {TZif} [  2] hits:      1, heat:   2, types: pure string
Fri              [  3] hits:      0, heat:   1, types: pure string
%D               [  3] hits:      0, heat:   1, types: string
ut               [  3] hits:      0, heat:   0, types: pure string
methodtype       [  4] hits:      1, heat:   0, types: pure string
cadt             [  3] hits:      0, heat:   0, types: pure string
libc*            [  2] hits:      1, heat:   1, types: pure string
split            [  2] hits:      3, heat:   1, types: pure string
CWT              [  3] hits:      1, heat:   2, types: string
AM               [  3] hits:      0, heat:   0, types: pure string
\\               [  3] hits:      2, heat:   3, types: string
get              [  6] hits:    138, heat: 125, types: pure string
option           [  2] hits:      5, heat:   2, types: pure string
add              [  5] hits:      3, heat:   0, types: pure string
$version eq {2}  [  2] hits:      1, heat:   2, types: pure string
$len > 1         [  2] hits:      0, heat:   0, types: pure string
![interp issafe] [  2] hits:      5, heat:   1, types: pure string
clear            [  4] hits:      1, heat:   0, types: pure string
ahst             [  3] hits:      0, heat:   0, types: pure string
CE               [  3] hits:      0, heat:   0, types: pure string
append           [  2] hits:      1, heat:   0, types: pure string
$major > 8       [  2] hits:      0, heat:   0, types: pure string
nextid           [  4] hits:      2, heat:   0, types: pure string
keep             [  4] hits:      2, heat:   0, types: pure string
scan             [  4] hits:     13, heat:  10, types: pure string
Dir              [  2] hits:      1, heat:   0, types: parsedVarName
wet              [  3] hits:      0, heat:   0, types: pure string
adt              [  3] hits:      0, heat:   0, types: pure string
major            [  2] hits:      0, heat:   0, types: pure string
$pkgroot eq "."  [  2] hits:      1, heat:   0, types: pure string
[llength $paths] [  2] hits:      1, heat:   0, types: pure string
export           [  2] hits:      9, heat:   4, types: pure string
char             [  2] hits:      1, heat:   2, types: pure string
%m/%d/%Y         [  5] hits:      2, heat:   2, types: string
item             [  2] hits:      0, heat:   0, types: pure string
origin           [  2] hits:      0, heat:   1, types: pure string
Thu              [  3] hits:      0, heat:   1, types: pure string
variables        [  4] hits:      1, heat:   0, types: pure string
Mon              [  3] hits:      0, heat:   1, types: pure string
1.6.1            [  2] hits:      0, heat:   0, types: pure string
minor            [  2] hits:      0, heat:   0, types: pure string
LOCALE_NUMERALS  [  3] hits:      0, heat:   0, types: pure string
bytelength       [  2] hits:      1, heat:   0, types: pure string
DT               [  2] hits:      0, heat:   1, types: string
first            [  2] hits:      1, heat:   2, types: pure string
ist              [  3] hits:      0, heat:   0, types: pure string
$failerror       [  2] hits:      0, heat:   0, types: pure string
loadedlocales    [  3] hits:      0, heat:   0, types: pure string
last             [  2] hits:      5, heat:   2, types: pure string
incr             [  2] hits:      6, heat:   3, types: pure string
range            [  2] hits:     21, heat:  15, types: pure string
zp4              [  3] hits:      0, heat:   0, types: pure string
zp5              [  3] hits:      0, heat:   0, types: pure string
TCLLIBPATH       [  3] hits:      2, heat:   0, types: pure string
zp6              [  3] hits:      0, heat:   0, types: pure string
tclversion       [  2] hits:      1, heat:   0, types: pure string
tuple            [  2] hits:      1, heat:   2, types: pure string
 $gmt            [  2] hits:      1, heat:   2, types: pure string
$ns ne ""        [  2] hits:      0, heat:   1, types: pure string
fst              [  3] hits:      0, heat:   0, types: pure string
rootname         [  2] hits:      0, heat:   0, types: pure string
ndt              [  3] hits:      0, heat:   0, types: pure string
-1               [  2] hits:      6, heat:   3, types: int
dir              [  2] hits:      1, heat:   0, types: pure string
yst              [  3] hits:      0, heat:   0, types: pure string
src              [  2] hits:      0, heat:   0, types: pure string
$satisfied       [  2] hits:      1, heat:   0, types: pure string
eval             [  5] hits:     16, heat:   5, types: pure string
-4               [  2] hits:      0, heat:   0, types: int
$pos >= 0        [  2] hits:      1, heat:   0, types: pure string
commands         [  2] hits:      3, heat:   1, types: pure string
-7               [  2] hits:      1, heat:   2, types: int
message          [  2] hits:      1, heat:   2, types: pure string
east             [  3] hits:      0, heat:   0, types: pure string
Sun              [  3] hits:      0, heat:   1, types: pure string
DATE_FORMAT      [  3] hits:      0, heat:   0, types: pure string
nzdt             [  3] hits:      0, heat:   0, types: pure string
cst              [  3] hits:      0, heat:   0, types: pure string
$p eq {}         [  2] hits:      0, heat:   0, types: pure string
kdt              [  3] hits:      0, heat:   0, types: pure string
create           [  6] hits:     12, heat:   6, types: pure string
idle             [  3] hits:      0, heat:   0, types: pure string
2299161          [  3] hits:      0, heat:   0, types: string
am               [  3] hits:      0, heat:   0, types: pure string
nft              [  3] hits:      0, heat:   0, types: pure string
level            [  2] hits:     13, heat:   6, types: pure string
mest             [  3] hits:      0, heat:   0, types: pure string
 $y < 100        [  2] hits:      1, heat:   2, types: pure string
parent           [  2] hits:      1, heat:   2, types: pure string
 $h eq {}        [  2] hits:      1, heat:   2, types: pure string
varName          [  2] hits:      0, heat:   0, types: pure string
LOOKUP           [  2] hits:      5, heat:   2, types: pure string
tcl_prompt1      [  2] hits:      0, heat:   1, types: pure string
at               [  3] hits:      0, heat:   0, types: pure string
"" ne $territory [  2] hits:      0, heat:   0, types: pure string
hdt              [  3] hits:      0, heat:   0, types: pure string
gmt              [  3] hits:      0, heat:   0, types: pure string
file             [  2] hits:      2, heat:   0, types: pure string
key              [  2] hits:      0, heat:   0, types: pure string
$p in $newpaths  [  2] hits:      1, heat:   0, types: pure string
sst              [  3] hits:      0, heat:   0, types: pure string
names            [  2] hits:      0, heat:   0, types: pure string
longest          [  2] hits:      1, heat:   0, types: pure string
bt               [  3] hits:      0, heat:   0, types: pure string
idlw             [  3] hits:      0, heat:   0, types: pure string
isset            [  4] hits:      1, heat:   1, types: pure string
locale           [  2] hits:      1, heat:   1, types: pure string
fwt              [  3] hits:      0, heat:   0, types: pure string
loaded           [  3] hits:      0, heat:   0, types: pure string
12               [  2] hits:      1, heat:   2, types: int
CDT              [117] hits:      1, heat:   2, types: string
edt              [  3] hits:      0, heat:   0, types: pure string
$length % 2      [  2] hits:      0, heat:   0, types: pure string
Oct              [  3] hits:      0, heat:   1, types: pure string
LC_MESSAGES      [  3] hits:      0, heat:   0, types: pure string
pst              [  3] hits:      0, heat:   0, types: pure string
msg              [  2] hits:      1, heat:   0, types: pure string
tcl_platform     [  3] hits:     10, heat:   1, types: parsedVarName
$stdHours>2      [  2] hits:      3, heat:   4, types: pure string
index            [  2] hits:      8, heat:   7, types: pure string
20               [  3] hits:      1, heat:   0, types: pure string
Jul              [  3] hits:      0, heat:   1, types: pure string
Apr              [  3] hits:      0, heat:   1, types: pure string
C.E.             [  3] hits:      0, heat:   0, types: pure string
Jun              [  3] hits:      0, heat:   1, types: pure string
23               [  2] hits:      0, heat:   0, types: pure string
forward          [  4] hits:      1, heat:   0, types: pure string
eet              [  3] hits:      0, heat:   0, types: pure string
28               [  3] hits:      0, heat:   0, types: int
29               [  3] hits:      0, heat:   0, types: int
30               [ 10] hits:      7, heat:   4, types: int
mst              [  3] hits:      0, heat:   0, types: pure string
31               [ 16] hits:     13, heat:   7, types: int
mewt             [  3] hits:      0, heat:   0, types: pure string
ep               [  2] hits:      1, heat:   0, types: pure string
						

How Much Duplication Is There Anyway?

Start tanzer (TclOO) web server, serve one hit with 412 invoices from a SQLite database:

Calls Entries Hits Misses Hit Rate
3,905 331 2,667 692 79%
logger           [  4] hits:      5, heat:   4, types: pure string
method           [  4] hits:     22, heat:  18, types: pure string
filters          [  6] hits:      2, heat:   1, types: pure string
Length           [  2] hits:      0, heat:   1, types: pure string
buffer           [  6] hits:     23, heat:  20, types: pure string
ev               [  2] hits:      1, heat:   0, types: pure string
rewritten        [  3] hits:      4, heat:   3, types: pure string
301              [  3] hits:      1, heat:   0, types: pure string
304              [  3] hits:      1, heat:   0, types: pure string
localPath        [  2] hits:      0, heat:   0, types: pure string
line             [  3] hits:      1, heat:   1, types: pure string
.so              [  2] hits:      1, heat:   0, types: pure string
Nov              [  4] hits:      1, heat:   1, types: pure string
current          [  2] hits:      1, heat:   0, types: pure string
cyan             [  5] hits:      3, heat:   0, types: pure string
bodyStart        [  3] hits:      0, heat:   1, types: pure string

                [  2] hits:      1, heat:   2, types: pure string
handler          [  6] hits:     21, heat:  19, types: pure string
dump             [  2] hits:      4, heat:   4, types: string
link             [  3] hits:      0, heat:   0, types: pure string
opts             [  9] hits:     27, heat:  24, types: pure string
newPath          [  2] hits:      1, heat:   1, types: pure string
seconds          [  4] hits:      2, heat:   0, types: pure string
requestLen       [  3] hits:      0, heat:   1, types: pure string
monthLength      [  2] hits:      0, heat:   0, types: pure string
8.5-             [  2] hits:      0, heat:   0, types: pure string
exists           [  7] hits:     45, heat:  14, types: pure string
uriParts         [  3] hits:      0, heat:   1, types: pure string
OK               [  3] hits:      1, heat:   0, types: pure string
Aug              [  4] hits:      1, heat:   1, types: pure string
Feb              [  4] hits:      1, heat:   1, types: pure string
part             [  3] hits:      4, heat:   4, types: pure string
join             [  2] hits:    145, heat:  36, types: pure string
::oo::InfoObject [  5] hits:      1, heat:   0, types: list
newline          [  4] hits:     13, heat:  12, types: pure string
arg              [  5] hits:      5, heat:   3, types: pure string
remaining        [  5] hits:     16, heat:  14, types: pure string
localDir         [  2] hits:      0, heat:   0, types: pure string
$status ne {}    [  2] hits:      0, heat:   1, types: pure string
which            [  2] hits:      8, heat:   3, types: pure string
root             [  4] hits:      0, heat:   0, types: pure string
value            [  7] hits:      8, heat:   7, types: pure string
path             [  6] hits:     34, heat:  31, types: pure string
newParams        [  3] hits:      0, heat:   1, types: pure string
1.1.0            [  2] hits:     13, heat:   6, types: pure string
sessions         [  6] hits:     19, heat:  15, types: pure string
Bad Request      [  3] hits:      1, heat:   0, types: pure string
etag             [  3] hits:      0, heat:   0, types: pure string
normalize        [  2] hits:      5, heat:   1, types: pure string
8.6.7            [  3] hits:     35, heat:   8, types: string
length           [  2] hits:     14, heat:   8, types: pure string
Content          [  2] hits:      2, heat:   3, types: pure string
tolower          [  2] hits:      0, heat:   1, types: pure string
package          [  2] hits:      1, heat:   0, types: parsedVarName
pattern          [  4] hits:     22, heat:  18, types: pure string
len              [  4] hits:      1, heat:   2, types: pure string
/invoices        [  2] hits:      0, heat:   1, types: pure string
[$session ended] [  2] hits:      0, heat:   0, types: pure string
name             [  7] hits:     14, heat:   9, types: pure string
*                [  2] hits:      9, heat:   3, types: string
EACCES           [  2] hits:      1, heat:   0, types: pure string
store            [  4] hits:      7, heat:   6, types: pure string
action           [  3] hits:      0, heat:   1, types: pure string
body             [  7] hits:    854, heat: 255, types: pure string
/                [  2] hits:    188, heat:  51, types: pure string
$watchdog ne {}  [  2] hits:      0, heat:   0, types: pure string
0                [  9] hits:      8, heat:   4, types: int
1                [  7] hits:      4, heat:   0, types: pure string
!$keepalive      [  2] hits:      0, heat:   1, types: pure string
$opts(new)       [  2] hits:      0, heat:   0, types: pure string
directory        [  3] hits:      0, heat:   0, types: pure string
$route ne {}     [  2] hits:      0, heat:   1, types: pure string
newProto         [  2] hits:      0, heat:   0, types: pure string
unset            [  2] hits:      0, heat:   1, types: pure string
end              [  3] hits:      0, heat:   1, types: pure string
invoices         [  2] hits:      3, heat:   3, types: string
dest             [  2] hits:      0, heat:   0, types: pure string
Mar              [  4] hits:      1, heat:   1, types: pure string
Content-Type     [  4] hits:      1, heat:   2, types: pure string
TCL              [  2] hits:      5, heat:   1, types: pure string
keepalive        [  6] hits:     25, heat:  22, types: pure string
May              [  4] hits:      1, heat:   1, types: pure string
$request ne {}   [  2] hits:      1, heat:   2, types: pure string
newMax           [  2] hits:      0, heat:   0, types: pure string
Sep              [  4] hits:      1, heat:   1, types: pure string
mixins           [  4] hits:      1, heat:   0, types: pure string
httpMethod       [  3] hits:      0, heat:   1, types: pure string
Jan              [  4] hits:      1, heat:   1, types: pure string
$opts(response)  [  2] hits:      1, heat:   2, types: pure string
eof              [  2] hits:      0, heat:   0, types: pure string
configure        [  2] hits:      2, heat:   1, types: pure string
Not Modified     [  3] hits:      1, heat:   0, types: pure string
::               [  2] hits:      2, heat:   0, types: pure string
list             [  3] hits:      1, heat:   0, types: pure string
readsize         [  4] hits:      1, heat:   1, types: pure string
route            [  5] hits:     13, heat:  12, types: pure string
newPattern       [  2] hits:      0, heat:   0, types: pure string
env              [  6] hits:     76, heat:  65, types: parsedVarName
wildcard         [  3] hits:      0, heat:   1, types: pure string
$opts(request)   [  2] hits:      0, heat:   1, types: pure string
session          [  4] hits:      9, heat:   6, types: pure string
$year % 4        [  2] hits:      1, heat:   1, types: pure string
newHeaderValue   [  3] hits:      1, heat:   2, types: pure string
INDEX            [  2] hits:      5, heat:   1, types: pure string
dirname          [  2] hits:     11, heat:   3, types: pure string
pa               [  2] hits:      1, heat:   0, types: pure string
headerValueExtra [  3] hits:      0, heat:   1, types: pure string
rfc2616          [  2] hits:      0, heat:   0, types: pure string
matching         [  3] hits:      0, heat:   1, types: pure string
ensemble         [  2] hits:      3, heat:   1, types: pure string
400              [  5] hits:      3, heat:   1, types: pure string
tmpHeaders       [  3] hits:      0, heat:   1, types: pure string
newSize          [  2] hits:      0, heat:   0, types: pure string
partRoute        [  3] hits:      0, heat:   1, types: pure string
map              [  4] hits:      5, heat:   1, types: pure string
403              [  3] hits:      1, heat:   0, types: pure string
newConfig        [  2] hits:      1, heat:   1, types: pure string
404              [  3] hits:      1, heat:   0, types: pure string
$opts(cancel)    [  2] hits:      0, heat:   0, types: pure string
!$found          [  2] hits:      0, heat:   0, types: pure string
405              [  3] hits:      1, heat:   0, types: pure string
[                [  3] hits:      8, heat:   5, types: string
status           [  6] hits:     15, heat:  16, types: pure string
args             [  3] hits:      5, heat:   2, types: pure string
match            [  4] hits:      5, heat:   1, types: pure string
newParams {}     [  2] hits:      0, heat:   0, types: pure string
412              [  3] hits:      1, heat:   0, types: pure string
http             [  3] hits:      1, heat:   1, types: pure string
::oo::InfoClass  [  5] hits:      1, heat:   0, types: list
responseParts    [  3] hits:      0, heat:   1, types: pure string
415              [  3] hits:      1, heat:   0, types: pure string
416              [  3] hits:      1, heat:   1, types: pure string
ubuntu           [  6] hits:      3, heat:   0, types: pure string
requirements     [  3] hits:      0, heat:   0, types: pure string
set              [  4] hits:     12, heat:   6, types: pure string
127.0.0.1        [  4] hits:      3, heat:   3, types: pure string
e                [  2] hits:      1, heat:   1, types: pure string
$ret != 0        [  2] hits:      1, heat:   0, types: pure string
server           [  8] hits:     32, heat:  27, types: parsedVarName
text/html        [  3] hits:      0, heat:   1, types: pure string
i                [  3] hits:      0, heat:   1, types: pure string
$part eq {}      [  2] hits:      0, heat:   1, types: pure string
library          [  2] hits:      1, heat:   0, types: pure string
script           [  5] hits:     17, heat:  12, types: pure string
$wildcard        [  2] hits:      0, heat:   1, types: pure string
newSession       [  2] hits:      0, heat:   0, types: pure string
User             [  2] hits:      2, heat:   3, types: pure string
toupper          [  2] hits:      0, heat:   1, types: pure string
TCL_LIBRARY      [  3] hits:      3, heat:   0, types: pure string
partRequest      [  3] hits:      0, heat:   1, types: pure string
Accept           [  2] hits:      1, heat:   2, types: pure string
$status >= 500   [  2] hits:      0, heat:   1, types: pure string
[chan eof $sock] [  2] hits:      0, heat:   0, types: pure string
uri              [  4] hits:     16, heat:  15, types: pure string
p                [  2] hits:      3, heat:   1, types: pure string
newSock          [  2] hits:      0, heat:   0, types: pure string
dirs             [  2] hits:      1, heat:   0, types: pure string
POSIX            [  2] hits:      6, heat:   1, types: pure string
Dec              [  4] hits:      1, heat:   1, types: pure string
headerEnding     [  3] hits:      0, heat:   1, types: pure string
Agent            [  2] hits:      2, heat:   3, types: pure string
text/plain       [  4] hits:      0, heat:   1, types: pure string
Invalid Request  [  4] hits:      1, heat:   1, types: pure string
nameofexecutable [  2] hits:      2, heat:   0, types: pure string
ENOENT           [  2] hits:      4, heat:   1, types: pure string
chunked          [  4] hits:     15, heat:  14, types: pure string
headerLength     [  4] hits:     13, heat:  12, types: pure string
index.html       [  4] hits:      0, heat:   0, types: pure string
4096             [  5] hits:      1, heat:   1, types: int
newlineLength    [  4] hits:     13, heat:  12, types: pure string
methods          [  4] hits:      1, heat:   0, types: pure string
version          [  6] hits:     23, heat:  22, types: pure string
newMin           [  2] hits:      0, heat:   0, types: pure string
st               [  2] hits:      1, heat:   1, types: pure string
$remaining == 0  [  2] hits:      0, heat:   0, types: pure string
sock             [  9] hits:     41, heat:  33, types: pure string
watchdog         [  5] hits:     25, heat:  22, types: pure string
socket           [  3] hits:      0, heat:   0, types: pure string
firstnl          [  3] hits:      0, heat:   1, types: pure string
entries          [  5] hits:     16, heat:  11, types: pure string
newHeaderName    [  3] hits:      1, heat:   2, types: pure string
trim             [  2] hits:      1, heat:   2, types: pure string
responded        [  5] hits:     10, heat:   9, types: pure string
found            [  3] hits:      0, heat:   0, types: pure string
here             [  2] hits:      1, heat:   0, types: parsedVarName
candidate        [  3] hits:      1, heat:   2, types: pure string
!$valid          [  2] hits:      0, heat:   1, types: pure string
port             [  2] hits:      1, heat:   1, types: pure string
preamble         [  3] hits:      0, heat:   1, types: pure string
$part eq ".."    [  2] hits:      1, heat:   1, types: pure string
params           [  3] hits:      4, heat:   3, types: pure string
cmd              [  2] hits:      1, heat:   0, types: pure string
defaults         [  3] hits:      0, heat:   0, types: pure string
uriOrig          [  4] hits:     11, heat:  10, types: pure string
error            [  4] hits:      1, heat:   1, types: pure string
newMethod        [  2] hits:      0, heat:   0, types: pure string
methodtype       [  4] hits:      1, heat:   0, types: pure string
with             [  2] hits:      0, heat:   0, types: pure string
split            [  2] hits:      3, heat:   1, types: pure string
convertfrom      [  2] hits:      0, heat:   0, types: pure string
def              [  3] hits:      0, heat:   0, types: pure string
cleanup          [  4] hits:     11, heat:  10, types: pure string
get              [  4] hits:     15, heat:   8, types: pure string
$len > 0         [  2] hits:      2, heat:   3, types: pure string
option           [  2] hits:      5, heat:   1, types: pure string
add              [  4] hits:      2, heat:   0, types: pure string
/dump            [  2] hits:      0, heat:   1, types: pure string
event "any"      [  2] hits:      0, heat:   0, types: pure string
![interp issafe] [  2] hits:      5, heat:   1, types: pure string
$newOpts ne {}   [  2] hits:      0, heat:   0, types: pure string
append           [  2] hits:      1, heat:   0, types: pure string
$uriOrig eq {}   [  2] hits:      0, heat:   1, types: pure string
listings         [  4] hits:      0, heat:   0, types: pure string
500              [  3] hits:      1, heat:   1, types: pure string
Host             [  2] hits:      8, heat:   9, types: pure string
characterSpecial [  3] hits:      0, heat:   0, types: pure string
response         [  9] hits:     16, heat:  14, types: pure string
Dir              [  2] hits:      1, heat:   0, types: parsedVarName
Connection       [  2] hits:      0, heat:   1, types: pure string
$end > 0         [  2] hits:      0, heat:   1, types: pure string
$pkgroot eq "."  [  2] hits:      1, heat:   0, types: pure string
[llength $paths] [  2] hits:      1, heat:   0, types: pure string
export           [  2] hits:      4, heat:   2, types: pure string
blockSpecial     [  3] hits:      0, heat:   0, types: pure string
Forbidden        [  3] hits:      1, heat:   0, types: pure string
query            [  3] hits:      0, heat:   1, types: pure string
errorStatus      [  5] hits:      1, heat:   1, types: pure string
errorMessage     [  5] hits:      1, heat:   1, types: pure string
httpUri          [  3] hits:      0, heat:   1, types: pure string
valid            [  3] hits:      0, heat:   1, types: pure string
request          [ 13] hits:     51, heat:  42, types: pure string
variables        [  4] hits:      1, heat:   0, types: pure string
headerName       [  3] hits:      0, heat:   1, types: pure string
200              [  3] hits:      1, heat:   0, types: pure string
proto            [  6] hits:     13, heat:  10, types: pure string
fifo             [  3] hits:      0, heat:   0, types: pure string
bytelength       [  2] hits:      1, heat:   0, types: pure string
$newUri eq ""    [  2] hits:      0, heat:   1, types: pure string
first            [  2] hits:      3, heat:   4, types: pure string
newHost          [  2] hits:      0, heat:   0, types: pure string
206              [  3] hits:      1, heat:   0, types: pure string
45008            [  3] hits:      0, heat:   1, types: pure string
last             [  2] hits:      3, heat:   1, types: pure string
incr             [  2] hits:      4, heat:   1, types: pure string
range            [  2] hits:     10, heat:   5, types: pure string
httpVersion      [  3] hits:      0, heat:   1, types: pure string
module           [  3] hits:      0, heat:   0, types: pure string
-*               [  2] hits:      0, heat:   0, types: pure string
TCLLIBPATH       [  3] hits:      2, heat:   0, types: pure string
partCount        [  3] hits:      0, heat:   1, types: pure string
$ready           [  2] hits:      0, heat:   0, types: pure string
tclversion       [  2] hits:      1, heat:   0, types: pure string
$request eq {}   [  2] hits:      0, heat:   0, types: pure string
$remaining != 0  [  2] hits:      0, heat:   1, types: pure string
pair             [  2] hits:      0, heat:   1, types: pure string
headers          [  8] hits:     93, heat:  92, types: pure string
config           [  8] hits:     30, heat:  21, types: pure string
host             [  4] hits:     22, heat:  18, types: pure string
-1               [  2] hits:      4, heat:   1, types: int
dir              [  2] hits:      1, heat:   0, types: pure string
$responded       [  2] hits:      0, heat:   1, types: pure string
test             [  3] hits:      0, heat:   0, types: pure string
$satisfied       [  2] hits:      1, heat:   0, types: pure string
eval             [  5] hits:     22, heat:   7, types: pure string
$pos >= 0        [  2] hits:      1, heat:   0, types: pure string
commands         [  2] hits:      3, heat:   1, types: pure string
message          [  3] hits:      1, heat:   1, types: pure string
start            [  3] hits:      0, heat:   1, types: pure string
8080             [  3] hits:      1, heat:   1, types: pure string
localhost        [  4] hits:      3, heat:   3, types: pure string
newSt            [  2] hits:      1, heat:   1, types: pure string
Type             [  2] hits:      1, heat:   2, types: pure string
new              [  3] hits:      1, heat:   1, types: pure string
event            [  3] hits:      5, heat:   3, types: pure string
prevchar         [  3] hits:      0, heat:   1, types: pure string
addr             [  2] hits:      0, heat:   0, types: pure string
%5B              [  3] hits:      7, heat:   5, types: string
create           [  6] hits:     11, heat:   5, types: pure string
%5D              [  3] hits:      7, heat:   5, types: string
newResponse      [  2] hits:      0, heat:   0, types: pure string
LOOKUP           [  2] hits:      5, heat:   1, types: pure string
::fconfigure     [  3] hits:      0, heat:   0, types: cmdName
newMimeType      [  2] hits:      0, heat:   0, types: pure string
invoice          [  2] hits:      1, heat:   1, types: string
static           [  2] hits:      1, heat:   1, types: string
file             [  3] hits:      3, heat:   1, types: pure string
key              [  4] hits:      2, heat:   2, types: pure string
$p in $newpaths  [  2] hits:      1, heat:   0, types: pure string
![my ready]      [  2] hits:      0, heat:   1, types: pure string
bufferLength     [  3] hits:      0, heat:   1, types: pure string
peer             [  3] hits:      0, heat:   0, types: pure string
eventType        [  2] hits:      0, heat:   0, types: pure string
cancel           [  3] hits:      1, heat:   1, types: pure string
newHeaders {}    [  2] hits:      1, heat:   0, types: pure string
data             [  3] hits:      3, heat:   1, types: pure string
unused           [  3] hits:      1, heat:   1, types: pure string
headerValue      [  3] hits:      0, heat:   1, types: pure string
date             [  3] hits:      0, heat:   0, types: pure string
Oct              [  4] hits:      1, heat:   1, types: pure string
newStatus        [  2] hits:      0, heat:   0, types: pure string
sock196cd80      [  3] hits:      0, heat:   0, types: pure string
msg              [  2] hits:      1, heat:   0, types: pure string
tcl_platform     [  3] hits:     10, heat:   1, types: parsedVarName
newOpts {}       [  2] hits:      0, heat:   0, types: pure string
Partial Content  [  3] hits:      1, heat:   0, types: pure string
index            [  5] hits:      3, heat:   2, types: pure string
pathInfo         [  3] hits:      0, heat:   1, types: pure string
router           [  6] hits:     17, heat:  12, types: pure string
$partCount < 2   [  2] hits:      0, heat:   1, types: pure string
Jul              [  4] hits:      1, heat:   1, types: pure string
Apr              [  4] hits:      1, heat:   1, types: pure string
44974            [  2] hits:      0, heat:   0, types: pure string
Jun              [  4] hits:      1, heat:   1, types: pure string
forward          [  4] hits:      1, heat:   0, types: pure string
$response ne {}  [  2] hits:      1, heat:   2, types: pure string
newUri ""        [  2] hits:      0, heat:   0, types: pure string
partsLen         [  3] hits:      0, heat:   1, types: pure string
$event ne "read" [  2] hits:      0, heat:   0, types: pure string
3.20.0           [  2] hits:      0, heat:   0, types: pure string
newServer        [  2] hits:      0, heat:   0, types: pure string
28               [  3] hits:      0, heat:   0, types: int
30               [  6] hits:      3, heat:   2, types: int
31               [  9] hits:      6, heat:   3, types: int
timestamp        [  4] hits:      7, heat:   6, types: pure string
$chunked ne ""   [  2] hits:      0, heat:   1, types: pure string
ready            [  5] hits:     18, heat:  16, types: pure string
Not Found        [  3] hits:      1, heat:   0, types: pure string
ep               [  2] hits:      1, heat:   0, types: pure string
$leap            [  2] hits:      1, heat:   1, types: pure string
newScript        [  2] hits:      0, heat:   0, types: pure string
0.1              [  2] hits:     42, heat:  21, types: pure string
						

Performance

Difficult to rigorously quantify:

  • Performance in synthetic benchmarks is not representative of real performance
  • Measurement seems to be more sensitive to frequency scaling than usual
  • Should provide more opportunities for reusing intreps
  • Could run into increased shimmering because values will be shared more widely than before

[info commands], 100,000 iterations:
Existing: 10.45295 microseconds per iteration
Dedup: 7.47978 microseconds per iteration

Challenges

  • Breaks assumptions about the refCount of Tcl_Objs returned by Tcl_NewStringObj. Fewer instances of this than I expected
  • Breaks the pattern of calling Tcl_DecrRefcount on a refCount 0 object to free it
  • It's possible to break the current design by allocating a very large number of items before incrementing any of their refCounts

Questions?