Forum OpenACS Development: Response to How about Apache 2.0?

Collapse
Posted by Alex Sokoloff on
I don't think I'm gonna get hired to benchmark scripting language performance, but here's the results of further investigation. I made a very simple test that iterated a counter:

set start [exec date]
set counter 0
while { $counter < 1000000 } {
    incr counter
}
set end [exec date]
set result "start: $start
end: $end"

(For what it's worth, the machine was a Pentium Pro, OS RH 6.2)

Execution time

  • Running from the command line, in tclsh: 4 seconds
  • aolserver32ad12 (therefore nsd8x), run as a procedure in the tcl directory: 14 seconds
  • aolserver32ad12, placed in a .tcl page under the pageroot (first time page run): 64 seconds
  • aolserver31 using nsd76, run as a procedure in the tcl directory: 87 seconds
  • aolserver31 using nsd76, placed in a .tcl page under the pageroot (first time): 85 seconds

I didn't actually make sure ns_cache was working with aolserver32, because I think you get the same effect if the code is in one of the procs loaded at startup.

I'm told that interpreted languages interpret every iteration of a loop if they don't tokenize or precompile the script - which would explain the sluggish performance above. And just looping through a zillion (well, actually a million) iterations of one line of code is probably a misleading test. I'll try to run the same test with a more complicated script that doesn't loop so much. At any rate it looks like using the preferred version of AOLserver, and enabling ns_cache if you don't put most of your code in procedures is definitely the way to go.