The first caches XName lookups for ClrPropertyInfo. This replaces the codegen of 4 XName.Get calls with a single one: (1) getter, (2) setter, (3) code model in ctor, (4) local types dictionary.
(1) and (2) are esp. interesting because they can be in hot paths if you're processing a lot of large documents.
The second caches the single IXMetaData.SchemaName lookup. This one is called a lot during document processing so it's worth avoiding the expensive XName lookup.
One could try to improve the codegen further by reusing the SchemaName cache for ClrPropertyInfo or getting rid of the XName lookups in the global types dictionary. Those tasks are more complex and have virtually no runtime benefit so I stopped here.
For your convenience, I have attached a before/after of one of my schemas.
test.zip
@mamift Before you do a release, I'm gonna fix a bug blunder in this PR!!
The caching fields are declared as string, they should be XName of course!
I'll do a PR to fix that today.
Fixes #19
This contains two commits.
The first caches XName lookups for ClrPropertyInfo. This replaces the codegen of 4 XName.Get calls with a single one: (1) getter, (2) setter, (3) code model in ctor, (4) local types dictionary. (1) and (2) are esp. interesting because they can be in hot paths if you're processing a lot of large documents.
The second caches the single
IXMetaData.SchemaName
lookup. This one is called a lot during document processing so it's worth avoiding the expensiveXName
lookup.One could try to improve the codegen further by reusing the
SchemaName
cache forClrPropertyInfo
or getting rid of the XName lookups in the global types dictionary. Those tasks are more complex and have virtually no runtime benefit so I stopped here.For your convenience, I have attached a before/after of one of my schemas. test.zip