Re: binary tcl scripts? is it possible? is it faster ?
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.tcl archive

Re: binary tcl scripts? is it possible? is it faster ?

From: Jeff Hobbs <jeffh@activestate.com>
Date: Thu Jun 30 2005 - 16:59:13 CEST

Walid wrote:
> I want to know, if it's possible to compile a library of tcl scripts
> and to load into the interpreter later ?

If you are looking to obfuscate your code from prying eyes, this
feature is the bytecode compiler, in TclPro with support through
8.3, and up-to-date support in ActiveState's Tcl Dev Kit:
        http://www.activestate.com/Tcl

> Also I want to know, (if this is possible) if TCL interpreter runs this
> scripts faster as it does for text scripts ?

It actually is not faster, and can be marginally slower at
startup. This is because the bytecodes are made portable (eg,
if you compile on an big-endian chip, it will still load just
fine on a little-endian chip, and no binary chars are used),
so the loading step needs to decode them from that portable
form to the native Tcl bytecode. Of course, Tcl has to do
this to all procedures on first use anyway, so the difference
in startup time is marginal for any reasonable complex script.

-- 
   Jeff Hobbs, The Tcl Guy
   http://www.ActiveState.com/, a division of Sophos
Received on Thu Sep 29 14:24:10 2005