From: Stephen D. <sd...@gm...> - 2006-07-13 21:40:06
|
On 7/13/06, Zoran Vasiljevic <zv...@ar...> wrote: > > Am 13.07.2006 um 23:18 schrieb Vlad Seryakov: > > > You are right and now i see that Naviserver does not do this right > > because our global cache keeps strings only. It looks like waste of > > resource now caching file contents only but ns_share uses Tcl_Objs > > internally, so it is possible to use it instead maybe? > > As I said: if you move bytecodes from interp to interp, they > get recompiled. The only way you can do that (bytecode cachbing) > is to keep it in the same thread and interp and this is what > Tcl procedures are already doing. > Right, I forgot about that. I asked about this on the Tcl list a couple of years ago... When an object is byte-code compiled it's environment is taken into account, and that affects the compiled code. For example, many of the built-in Tcl commands now get inlined: for, while etc. But what if they've been redefined by user code? If you byte-code compile some code in one environment, then try to run it in another, it may not work if the environments are different. So the Tcl core detects and prevents this. All code is recompiled the first time it is run in a new environment. I was suggesting that maybe there should be a away around this as in some cases, like ours, we specifically make sure that all interps are identical: we create one master interp at start up and then clone it for each new thread. No one seemed excited by this though... |