On 12/12/06, Zoran Vasiljevic <[EMAIL PROTECTED]> wrote:

On the behalf of Gustaf, as his email didn't
reach the list (for some obscure reason):

Begin forwarded message:

> -------- Original-Nachricht --------
> Betreff:      Re: [naviserver-devel] Benchmarks
> Datum:        Mon, 11 Dec 2006 19:12:33 +0100
> Von:  Gustaf Neumann <[EMAIL PROTECTED]>
> An:   naviserver-devel@lists.sourceforge.net
> Referenzen:   <[EMAIL PROTECTED]>
>
>
>
> what happens, if you try byte-compiled code, e.g.:
>
> test.adp
> ------------------------------------
>
> <BODY>
> Test list <%=[ns_fmttime [ns_time]]%>
> <P>
> <UL>
>
> <%
> proc foo {n} {  for { set i 0 } { $i < $n } { incr i }
> { ns_adp_puts $i }}
> foo 50
> %>
>
> </UL>
> </BODY>


ADP Tcl fragments should be byte compiled. The system goes out of it's
way to store the fragments in thread-local caches so that the Tcl
byte-code which is generated after the first call to 'eval' can be
reused for future requests.

Couple of things to keep in mind:

The Tcl compiler would often optimize proc bodys more aggressively
than bare code passed to eval. Would be good to try Tcl 8.5 here,
which after 5 years looks like it's almost done... :-)

The ADP being tested has two Tcl fragments, the .tcl file is compiled
to a single proc.

A nice optimisation would be to combine the Tcl fragments together
into a single blob/proc to run, which would append the result of each
fragment to the same output buffer, noting the start and end position.
ADP would then use vectored io to dump the string chunks interleaved
with the result buffer segments. The advantage here would be on more
realistic pages with large chunks of text, which now would not need to
be copied around, and in amortizing all the little buffer appends for
the Tcl results into a single buffer.


Another simple optimisation would be to not stat the .adp on disk for
each request. Not something we're doing worse than anyone else here,
although I'm sure they have the option to turn stat off, but would be
relatively easy to put e.g. a 5 sec delay on each stat (checked
against the connection start time to avoid an extra call to
gettimeofday).

Oh, and turn off atime updates for the directory containing your web
pages, and additionally turn off mtime updates for your log files.
Free and easy.

Reply via email to