Selon Zoran Vasiljevic <[EMAIL PROTECTED]>:
> On Thursday 26 February 2004 11:14, you wrote:
>
> Because your code may modify some state during the execution of the
> procedure and I have to make sure that next run gets a clean
> interp state.
> The "regular" way to change the state is to run "ns_eval". So, this
> was just a means of getting rid of *unwanted* state propagation.
>
> >
>
> Thanks for your efforts. Nevertheless, I may revert to many-nsv arrays
> since the cleanup code is sometimes very handy.
>

I checked the ttrace::addcleanup proc.

So I am suspecting the default "ttrace::cleanup" proc to be a bottleneck.
Your code is doing things that are good for cleanup but that may be time comsuming !

You are right as a first solution should be to split nsv array. But may be the
rest of your cleanup code can be time consuming as well.
When enabling the ttrace package, my CPU is going really high. It can be due to
string copying (proc body) :

                set new [lindex $def 0]
                set old $resolveproc($cmd)

and body comparing "$new != $old"

For benchmark tests, I will try to change from :

----------------------------------------------

    ttrace::addcleanup {
        variable resolveproc
        foreach cmd [array names resolveproc] {
            set def [ttrace::getentry proc $cmd]
            if {$def != ""} {
                set new [lindex $def 0]
                set old $resolveproc($cmd)
                if {[info command $cmd] != "" && $new != $old} {
                    catch {rename $cmd ""}
                }
            }
        }
    }

----------------------------------------------

to

    ttrace::addcleanup {
        variable resolveproc
        foreach cmd [array names resolveproc] {
            set def [ttrace::getentry proc $cmd]
            if {$def != ""} {
                if {[info command $cmd] != "" && [string compare [lindex $def 0]
$resolveproc($cmd)] } {
                    catch {rename $cmd ""}
                }
            }
        }
    }

----------------------------------------------

and do some benchmarking on my prod server.
This is not code optimzation but I can perhaps see little changed (in good or
bad) to check if this proc can be seen as bottleneck or not.

I will keep you informed about the results.

Anyway, I have a question about this cleanup : If I am sure I am not changing the
interp state and procs, there is no need to run this cleanup.
Am I right ?

I never use ns_eval on my web site, and I think (90% sure) my procs don't change
the interp state.
So I can just remove the cleanup and that would speed up dramatically my server.
Am I right, or am I missing something ?

Regards.

JFR


--
AOLserver - http://www.aolserver.com/

To Remove yourself from this list, simply send an email to <[EMAIL PROTECTED]> with the
body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: field of 
your email blank.

Reply via email to