[Mono-dev] ASP.NET 2.0 performance discussion.
Marek Habersack
grendel at caudium.net
Thu Nov 23 05:24:17 EST 2006
On Wed, 22 Nov 2006 20:32:47 -0500, Miguel de Icaza <miguel at ximian.com>
scribbled:
> Hello,
>
> > To make the description less chaotic, here's what I was thinking
> > about implementing the support. The XML files that define browsers
> > are pretty complex, but in general, they rely on regular
> > expressions. During the application startup time we'd compile all
> > the expressions, store them in some structure (it would need to be
> > hierarchic, since browser matching can be nested) and set up an
> > ApplicationDomain-wide cache for already matched browser UAs. The
> > UA cache could be a SortedList, and we would use the full UAs to
> > look up the browser capabilities. That way, as the browsers visit
> > the site, the cache would provide faster access to the
> > capabilities, until the application would have to be restarted. It
> > would certainly be some improvement. Of course, finding out how to
> > avoid loading the database every time would be the best improvement.
>
> Another thing that might be worth looking into are the properties that
> we actually consume. As far as I know, we could be turning hundreds
> of separate entries into the same entry as we might not even care
> about the differences.
Yes, but it's a big effort - MS.NET browser definitions are above 10k
lines of XML. It's especially hard that the new XML database matches
also on headers other than the UA.
> Although there are wildcards in the definition, the majority of the
> wildcards (for the majority of the browsers) happen at the end, so we
> do not even need a regular expression engine to run this beast.
Take a look at a fragment of XML from the new browser database:
<browsers>
<!-- Assume this is a desktop browser -->
<!-- sample UA "Go.Web/1.1 (UP.Browser/3.1-UPG1 UP.Link/3.2; Mozilla/1.0; RIM957; Elaine/1.0 )" -->
<!-- sample UA "Mozilla/1.0[en];Go.Web/1.1 (compatible; MSIE 2.0; HandHttp 1.1; Palm)" -->
<browser id="Mozilla" parentID="Default">
<identification>
<userAgent match="Mozilla" />
<userAgent nonMatch="MME|Opera" />
</identification>
<capture>
<userAgent match="Mozilla/(?'version'(?'major'\d+)(?'minor'\.\d+)\w*)" />
<userAgent match=" (?'screenWidth'\d*)x(?'screenHeight'\d*)" />
</capture>
<capabilities>
<capability name="browser" value="Mozilla" />
[snip]
</capabilities>
</browser>
<gateway id="MozillaBeta" parentID="Mozilla">
<identification>
<userAgent match="Mozilla/\d+\.\d+b" />
</identification>
<capture>
</capture>
<capabilities>
<capability name="beta" value="true" />
</capabilities>
</gateway>
So we can't really escape the regexps.
> We could easily shortcut any of the keys that end with a "*" and flag
> them as "Use StartsWith" for the UA matching.
That could be done by hand-massaging the regexps in the .browser files, yeah.
> This is an area of code that we have not really exercised in the past
> in benchmarks, but it is very likely that any larger applications
> (specially any Ajax happy one) would have ended up doing this.
>
> So fixing this for 1.0 will be useful.
And it should be easier to fix for 1.0 than for 2+
best regards,
marek
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20061123/2bb6b767/attachment.bin
More information about the Mono-devel-list
mailing list