Forum OpenACS Q&A: Performance gain by TCL byte code?
did someone try to pre-compile all/some of the API or Modules with the TCL bytecode compiler? Did this result in better performance?
is this work from Rob Mayoff included in all AOLservers? Or is this special work for the OpenACS version?
Overall, it's a fantastic feature -- many pages load about 10 times faster once compiled.
One guess as to why you're seeing the multiple-compile/cycle behavior: AOLserver maintains a seperate TCL interpreter for each thread. Probably these interpreters don't share compiled versions of TCL scripts, so when you hit a script that a particular thread's interpreter hasn't compiled yet, you have to go through compilation again despite the fact that some other thread may have already compiled it. And if the compiled versions vary, the behavior you observe will vary depending on which thread services a particular request.
(Caveat: 10 minutes spent looking over the AOLserver source doesn't give me a definite answer about unshared compiled versions, so I'm not 100% certain on this.)