[stringtemplate-interest] IAttributeRenderer and Type Inheritancein C#

Sam Harwell sharwell at pixelminegames.com
Thu Oct 22 21:10:57 PDT 2009


Hi Vincent and Jonathan,

 

I can't tell who said what here due to the way your editors formatted
the text. I thought about a possible solution to the performance
problems I mentioned, but I don't think it will be viable. I thought
about always caching the results of the lookup, so object interfaces
would only need to be checked the first time a type was used in a
template. Unfortunately, due to the way templates inherit attribute
renderers, several problems emerge:

 

1.       Caching the renderers would result in a copy of all
type->renderer maps in every template, incurring both a space and time
overhead.

2.       Caching the renderers would break the attribute renderer
inheritance scheme.

3.       Not caching the renderers would mean checking all interface
base types and interfaces while walking up the template inheritance
chain. This would be a more substantial hit than GetAttribute, likely
more than doubling the time required to render templates. I'll profile
this to make sure, but if my analysis proves correct the feature will
have to be completely reengineered before we could talk about
incorporating it into the library.

 

Sam

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/stringtemplate-interest/attachments/20091022/c9f14a6f/attachment-0001.html 


More information about the stringtemplate-interest mailing list