Philip Mak wrote:
>
> On Tue, 21 Aug 2001, Henrik Tougaard wrote:
>
> > It couldbe done with a XMLsub, but isn't that a bit overkill.
>
> I've been wondering about that---how much processing time does XMLSub use
> up?
>
XMLSubs insert a few variable assignments and a subroutine call
into the script code, so there is definitely overhead, but because
Apache::ASP script execution is so fast, I'm not sure one should
worry about this.
On a little benchmark I just put together which did 20 <input>
tags & equivalent XMLSubs, there was about a 13% difference in
the script runtime, where the XMLSubs were slower. I would expect
there to be less of a relative difference the more your scripts
were actually doing.
Document Path: /asp/eg/bench_xmlsubs/index.asp
Time taken for tests: 9.572 seconds
Requests per second: 104.47
Document Path: /asp/eg/bench_xmlsubs/index_subs.asp
Time taken for tests: 10.991 seconds
Requests per second: 90.98
# .htaccess
PerlSetVar XMLSubsMatch my:input
PerlSetVar Global .
PerlSetVar NoState 1
# global.asa
sub my::input {
my($args, $html) = @_;
$args->{value} = $Server->HTMLEncode($args->{value});
print "<input ". join(" ",map { "$_=\"$args->{$_}\"" } keys %$args).">\n";
}
# index.asp, without XMLSubs
<% my $data="asdfsadf&&&&&asdfsdafa"; %>
<% for my $count (1..20) { %>
<input name="text<%= $count %>" value="<%= $Server->HTMLEncode($data) %>">
<% } %>
# index_subs.asp, with XMLSubs
<% my $data="asdfsadf&&&&&asdfsdafa"; %>
<% for my $count (1..20) { %>
<my:input name="text$count" value="$data" />
<% } %>
--Josh
_________________________________________________________________
Joshua Chamas Chamas Enterprises Inc.
NodeWorks Founder Huntington Beach, CA USA
http://www.nodeworks.com 1-714-625-4051
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]