[Mono-dev] ASP.NET 2.0 performance discussion.
Miguel de Icaza
miguel at ximian.com
Wed Nov 22 20:32:47 EST 2006
> 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
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.
We could easily shortcut any of the keys that end with a "*" and flag
them as "Use StartsWith" for the UA matching.
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.
More information about the Mono-devel-list