Top-level command invokations not compiled

This is a discussion on Top-level command invokations not compiled within the TCL forums in Programming Languages category; Hi, There are many places where the following note is mentioned: "Top-level invokations of commands are not byte-compiled, so be aware to put most of them into procedure(s), so they run faster." -...or something like that. Well, why aren't they compiled? What is the reason to aviod compiling them? -- Pozdrawiam! (Regards!) Googie...

Go Back   Application Development Forum > Programming Languages > TCL

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 08-27-2008, 08:08 AM
Googie
Guest
 
Default Top-level command invokations not compiled

Hi,

There are many places where the following note is mentioned:

"Top-level invokations of commands are not byte-compiled, so be aware to put
most of them into procedure(s), so they run faster." -...or something like
that.

Well, why aren't they compiled? What is the reason to aviod compiling them?

--
Pozdrawiam! (Regards!)
Googie
Reply With Quote
  #2  
Old 08-27-2008, 08:36 AM
Alexandre Ferrieux
Guest
 
Default Re: Top-level command invokations not compiled

On Aug 27, 2:08 pm, Googie <n...@spam.0rg> wrote:
> Hi,
>
> There are many places where the following note is mentioned:
>
> "Top-level invokations of commands are not byte-compiled, so be aware to put
> most of them into procedure(s), so they run faster." -...or something like
> that.
>
> Well, why aren't they compiled? What is the reason to aviod compiling them?


Because since they are toplevel they will run just once, hence the
cost of compiling them will not be diluted over several runs of the
bytecode. See Miguel's recent summary on this:

http://groups.google.com/group/comp....1bafa752a80104

-Alex
Reply With Quote
  #3  
Old 08-27-2008, 08:39 AM
suchenwi
Guest
 
Default Re: Top-level command invokations not compiled

On 27 Aug., 14:36, Alexandre Ferrieux <alexandre.ferri...@gmail.com>
wrote:

> Because since they are toplevel they will run just once, hence the
> cost of compiling them will not be diluted over several runs of the
> bytecode. See Miguel's recent summary on this:
>
> http://groups.google.com/group/comp....e_frm/thread/d...


If you want to force compilation, put the code in question into an "if
1 { ... }" block.
Code in procedures still has the advantage that local variables can be
dealt with more efficiently.
Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 08:00 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.