Version 44 of List of Tcl commands by bytecode status

Updated 2012-10-31 14:46:22 by dkf

This page is driven mostly by the 8.6 manual build .

Note that some commands may be listed with a **** against them. That is because they are present in multiple categories; they are ensembles (and related) and have partial compilations.

Already bytecoded

Technically, some of these are only done on the dkf-compile-misc-info branch.

append
break
catch
concat
continue
dict ****
    dict append
    dict exists
    dict for
    dict get
    dict incr
    dict lappend
    dict map
    dict set
    dict unset
    dict update
    dict with
error
eval
expr
for
foreach
format
global
if
incr
info ****
    info commands
    info coroutine
    info exists
    info level
lappend
lassign
lindex
list
llength
lmap
lrange
lreplace
lset
namespace ****
    namespace code
    namespace current
    namespace upvar
    namespace which
regexp
regsub
return
self ****
    self namespace
    self object
set
string ****
    string compare
    string equal
    string first
    string index
    string length
    string map
    string match
    string range
subst
switch
tcl::mathop
    tcl::mathop::!
    tcl::mathop::!=
    tcl::mathop::%
    tcl::mathop::&
    tcl::mathop::*
    tcl::mathop::**
    tcl::mathop::+
    tcl::mathop::-
    tcl::mathop::/
    tcl::mathop::<
    tcl::mathop::<<
    tcl::mathop::<=
    tcl::mathop::==
    tcl::mathop::>
    tcl::mathop::>=
    tcl::mathop::>>
    tcl::mathop::^
    tcl::mathop::eq
    tcl::mathop::in
    tcl::mathop::ne
    tcl::mathop::ni
    tcl::mathop::|
    tcl::mathop::~
throw
try
unset
unsupported ****
    tcl::unsupported::assemble
upvar
variable
while
yield

AMG: lmap?

DKF: Yes, indeed (and dict map too)! See TIP #405 for the details; the code was committed on Oct 18. More to the point, some commands (info coroutine, info level, namespace current and self object) aren't yet BCCed on the trunk.

I chose to do those four because they're things that are relatively accessible to the bytecode engine.

AMG: I'm glad to see [info coroutine], which is performance-critical to Wibble. You may have noticed SEH's contributions to the Wibble implementation, mostly driven by performance. One thing he did was try to cache [info coroutine] in a variable. It seems to me an optimized [info coroutine] ought to take less time than reading a variable.

DKF: Don't get your hopes up too much; reading a local variable whose name is known at compile time is exceptionally fast (assuming it is untraced).

Potential candidates for bytecoding

Note that there is no consideration of whether these should be bytecoded; with many of them, it might well be a very bad idea for other reasons (e.g., costly internal algorithms).

(Note also that anything marked with !!! is ultra-unlikely to be done, on the grounds that it is rare in real code.)

DKF: I'm guessing that next, tailcall, yield and yieldto would be good candidates. Maybe also some variants of array unset (those that can be based on the existing unset machinery) and some more dict subcommands. We also ought to be able to do namespace code, though I'm not sure how much of a win that is. Maybe some cases of string is could be done too, though I'm not convinced that would be a net win. uplevel would be good, but I'm really uncertain about how to do it (except in the uplevel 0 case, which is rather low-value). Also, self namespace can probably be done, and if we were to do string map we might also be able to handle some regsub cases (which would definitely benefit some users' code). We can also probably handle some format cases (e.g., “all literals” and “only %s used in format string”).

DKF: Turns out to be impossible to do array unset; you get a difference in the trace behavior which you can't work around. Unless I was to add in a special instruction for doing just that particular thing (a “synch the array entries” trace)… Hmm…

Filtered Candidates

array unsetRequires new opcode to get trace semantics right.
dict createRarely used.
dict mergeThe other relatively common non-compiled dict subcommand in tcllib.
nextRelatively common; complex because of NRE interaction.
nexttoMaybe; the complexity might not be justifiable.
string isMaybe, for cases where we can do it and if the performance difference makes sense.
tailcallRelatively common; complex because of NRE interaction.
uplevel 0Very rarely used! (i.e., long possible but not present in tcllib)
yieldtoNot hugely common but would benefit coroutines quite a bit.

AMG: Regarding [uplevel 0]: I think the major use case for this command went away when we fixed/broke the nested array bug/feature. I recently used [uplevel 0] because I had a bunch of commands operating on a variable name that resulted from several substitutions I got tired of typing all the time, but I later redesigned the code to avoid it.

Commands that will never be bytecoded

Low-level details/internals

These are commands that access information that is probably not best used in production systems, or do things that are largely obsolete.

DKF: I know my assertion that info tclversion is obsolete is somewhat controversial, but info patchlevel has been useful for much longer, and package's relationship to the Tcl package is probably more relevant anyway.

OS connectivity, script library

These are commands where the dominant performance factors are the OS, or they are deliberately kept as scripted commands. In either case, there's no real benefit to bytecoding (there are better choices of place to put effort).

after
    after <ms>
    after cancel
    after idle
    after info
auto_execok
auto_import
auto_load
auto_mkindex
auto_path
auto_qualify
auto_reset
bgerror
cd
chan
    chan blocked
    chan close
    chan configure
    chan copy
    chan create
    chan eof
    chan event
    chan flush
    chan gets
    chan names
    chan pending
    chan pipe
    chan pop
    chan postevent
    chan push
    chan puts
    chan read
    chan seek
    chan tell
    chan truncate
clock
    clock add
    clock clicks
    clock format
    clock microseconds
    clock milliseconds
    clock scan
    clock seconds
close
dde
    dde eval
    dde execute
    dde poke
    dde request
    dde servername
    dde services
encoding
    encoding convertfrom
    encoding convertto
    encoding dirs
    encoding names
eof
exec
exit
fblocked
fconfigure
fcopy
file
    file atime
    file attributes
    file channels
    file copy
    file delete
    file dirname
    file executable
    file exists
    file extension
    file isdirectory
    file isfile
    file join
    file link
    file lstat
    file mkdir
    file mtime
    file nativename
    file normalize
    file owned
    file pathtype
    file readable
    file readlink
    file rename
    file rootname
    file separator
    file size
    file split
    file stat
    file system
    file tail
    file tempfile
    file type
    file volumes
    file writable
fileevent
flush
gets
glob
history
    history add
    history change
    history clear
    history event
    history info
    history keep
    history nextid
    history redo
http
    http::cleanup
    http::code
    http::config
    http::data
    http::error
    http::formatQuery
    http::geturl
    http::meta
    http::ncode
    http::register
    http::reset
    http::size
    http::status
    http::unregister
    http::wait
info ****
    info hostname
    info library
    info loaded
    info nameofexecutable
    info sharedlibextension
interp ****
    interp aliases
    interp bgerror
    interp cancel
    interp debug
    interp eval
    interp exists
    interp hidden
    interp invokehidden
    interp issafe
    interp limit
    interp marktrusted
    interp recursionlimit
    interp share
    interp slaves
    interp target
    interp transfer
load
msgcat
    msgcat::mc
    msgcat::mcflmset
    msgcat::mcflset
    msgcat::mcload
    msgcat::mclocale
    msgcat::mcmax
    msgcat::mcmset
    msgcat::mcpreferences
    msgcat::mcset
    msgcat::mcunknown
open
package
    package forget
    package ifneeded
    package names
    package prefer
    package present
    package provide
    package require
    package require
    package unknown
    package vcompare
    package versions
    package vsatisfies
parray
pid
pkg::create
pkg_mkIndex
platform
    platform::generic
    platform::identify
    platform::patterns
platform::shell
    platform::shell::generic
    platform::shell::identify
    platform::shell::platform
puts
pwd
read
registry
    registry broadcast
    registry delete
    registry get
    registry keys
    registry set
    registry type
    registry values
safe ****
    safe::interpAddToAccessPath
    safe::interpConfigure
    safe::interpDelete
    safe::interpFindInAccessPath
    safe::interpInit
    safe::setLogCmd
seek
socket
source
tcl_endOfWord
tcl_findLibrary
tcl_startOfNextWord
tcl_startOfPreviousWord
tcl_wordBreakAfter
tcl_wordBreakBefore
tcltest
    tcltest::bytestring
    tcltest::cleanupTests
    tcltest::configure
    tcltest::customMatch
    tcltest::debug
    tcltest::errorChannel
    tcltest::errorFile
    tcltest::interpreter
    tcltest::limitConstraints
    tcltest::loadFile
    tcltest::loadScript
    tcltest::loadTestedCommands
    tcltest::makeDirectory
    tcltest::makeFile
    tcltest::match
    tcltest::matchDirectories
    tcltest::matchFiles
    tcltest::normalizeMsg
    tcltest::normalizePath
    tcltest::outputChannel
    tcltest::outputFile
    tcltest::preserveCore
    tcltest::removeDirectory
    tcltest::removeFile
    tcltest::runAllTests
    tcltest::singleProcess
    tcltest::skip
    tcltest::skipDirectories
    tcltest::skipFiles
    tcltest::temporaryDirectory
    tcltest::test
    tcltest::testConstraint
    tcltest::testsDirectory
    tcltest::verbose
    tcltest::viewFile
    tcltest::workingDirectory
tell
tm
    tcl::tm::path
    tcl::tm::roots
trace
    trace add
    trace info
    trace remove
    trace variable
    trace vdelete
    trace vinfo
unknown
unload
update
vwait
zlib
    zlib adler32
    zlib compress
    zlib crc32
    zlib decompress
    zlib deflate
    zlib gunzip
    zlib gzip
    zlib inflate
    zlib push
    zlib stream

Command creation and related

These create commands and do related tricks; they mostly benefit a lot from bytecoding, but there's little value in boosting them themselves. (Though rename is a special case in that it is possible to sensibly bytecode it, but it is much more likely to trigger a progressive recompile than nearly any other command.)

Not actually commands

These have manpage links, but aren't commands as such.

Tcl
argc
argv
argv0
env
errorCode
errorInfo
filename
re_syntax
refchan
tcl_interactive
tcl_library
tcl_nonwordchars
tcl_patchLevel
tcl_pkgPath
tcl_platform
tcl_precision
tcl_rcFileName
tcl_traceCompile
tcl_traceEval
tcl_version
tcl_wordchars
transchan