Hi guys.

I came across a few performance problems when rendering views in one of our
applications.
dotTracing into the problem, I managed to identify a few problems internal
to AspView which I will commit to the codbase.
However, one of the main problems are with AspView's usage of the
DictionaryAdapterFactory.

The view engine creates a typed-adapter for each view instance. We have a
few pages which renders hundreds of sub views, and the amount of calls to
factory.GetAdapter<IView>(properties) costs a significant amount of the
rendering time.

Looking at GetAdapter() call, I saw that when asking for an adapter over an
interface that was already requested before, it is true that we do not
re-generate the type and the assembly, but we still do a pricey lookup for
the exact Type from all of the dynamically loaded assemblies.
I introduced a Dictionary<Type,Type>, that will cache the adapter type for
each interface, making consecutive calls *much* faster.

The attached test case when (on my machine) from 16ms to 3ms.

Attached also is the change patch.

For all of you IDictAdapter people, please revise the patch.

Should this change be incorporated into the DictionaryAdapter, there will be
some more cleanup we'll be able to do (such as the AssemblyName to Assembly
cache that is not needed anymore)






-- 
Ken Egozi.
http://www.kenegozi.com/blog
http://www.delver.com
http://www.musicglue.com
http://www.castleproject.org
http://www.idcc.co.il - הכנס הקהילתי הראשון למפתחי דוטנט - בואו בהמוניכם

-- 
You received this message because you are subscribed to the Google Groups 
"Castle Project Development List" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/castle-project-devel?hl=en.

Attachment: DictionaryAdapter performance.patch
Description: Binary data

Attachment: DictionaryAdapter performance tester.cs
Description: Binary data

Reply via email to