[stringtemplate-interest] IAttributeRenderer and Type Inheritancein C#

Jonathan Buhacoff jonathan at buhacoff.net
Fri Oct 23 16:54:50 PDT 2009


Hi Sam,

My last suggestion solves the performance and priority issues:

A separate method for setting a list of interface renderers

Something like:  public void setRenderers(List<AttributeRenderer>  
renderers)

Then in StringTemplate this list of renderers would be checked only if  
a class renderer wasnt found.

Performance issues would then only affect people using this feature.





Sent from my iPhone

On Oct 22, 2009, at 9:10 PM, "Sam Harwell"  
<sharwell at pixelminegames.com> wrote:

> Hi Vincent and Jonathan,
>
>
>
> I can’t tell who said what here due to the way your editors formatte 
> d the text. I thought about a possible solution to the performance p 
> roblems 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 t 
> emplate. Unfortunately, due to the way templates inherit attribute r 
> enderers, 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’l 
> l profile this to make sure, but if my analysis proves correct the f 
> eature 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/20091023/7c4b3bff/attachment.html 


More information about the stringtemplate-interest mailing list