Re: Tcl bytecode



On Jan 30, 7:02 pm, Keith Nash <k...@xxxxxxxxxxxxxxxx> wrote:
Jeff Hobbs wrote:
No, it actually uses the same bytecodes. However, TDK has to make the
bytecode portable (no BE vs. LE issues allowed), so that is part of the
extra translation that doesn't make this loader faster.

<snip>

One main reason that this hasn't been an issue is that there isn't a
huge overhead to compiling. Other languages have more compile overhead,
so it makes more sense there to precompile. Perl for example likes to
do a full syntax parse, even over code areas that won't be used. Tcl is
much lazier - it only compiles procs as it first executes them. This
distributes any compile overhead over the runtime of the application.

Some large Tcl apps are slow to start: is this because too many procs are
executed in the startup script?

Python seems to have a good compromise: when it is installed for the first
time, all the libraries are compiled and saved locally as *.pyc files
alongside the *.py originals. This way there are no portability issues.
Also, tampering with the *.pyc file is presumably no more difficult than
tampering with the original *.py.

Keith.

Python also compiles all the modules imported to an application upon
first time running the application. This is done in order to shorten
startup time the next time the application is started. Funny, but I
don't notice a difference between compiled Python and tcl scripts
startup times. Python's IDLE takes more time to start than tkcon, but
tkcon is a smaller application so it might not be a good comparison. I
also think that tcl's code parsing is way faster then Python's, due to
tcl's simple syntax: "command params", so bytcode files are not really
necessary.
I once also wondered why not have bytecode files in tcl, but now I
think that after all I don't miss them. 1) tcl scripts startup time is
not so long (at least compared to Python) and 2) I prefer my script
directory not filled up with other files (generated bytecode) than my
own source files.

iu2

.



Relevant Pages

  • Re: building a starkit of Img?
    ... Because if I use my system Tcl, some things are going to be different, ... compile stuff, so that that ... Not yet:-) I'm actually trying to just do an Img starkit, ... > truly simple, quick, and robust installs are acceptable. ...
    (comp.lang.tcl)
  • Re: CEPTCL: Doesnt RX multicast, has anyone seen it work before?
    ... on my Linux. ... gave me are set up to compile for windows. ... has all of the files and the makefile is set up for Linux too. ... please modify the Makefile for proper Tcl path. ...
    (comp.lang.tcl)
  • Re: Tcl bytecode
    ... However, their purpose is to obfuscate code, and loading them is slower than parsing genuine Tcl source files:) ... However, TDK has to make the bytecode portable, so that is part of the extra translation that doesn't make this loader faster. ... Other languages have more compile overhead, so it makes more sense there to precompile. ...
    (comp.lang.tcl)
  • Re: convert tcl in a standalone application thanks to MinGw
    ... already many proposed solution, I didn't find the right solution. ... I found it cool to combine C and tcl. ... you only have to compile your c extension and any C compiler may ... set rootdir $starkit::topdir ...
    (comp.lang.tcl)
  • Re: tcl upgrade on redhat 5.2
    ... I ran "make" and the tcl compile went ... switch as I did with the tcl. ... Must I be in XWindows to compile TK? ...
    (comp.lang.tcl)