[stringtemplate-interest] IAttributeRenderer and Type Inheritancein C#

Vincent DARON vdaron at ask.be
Thu Oct 22 23:42:34 PDT 2009


Hi Jonathan and Sam,

The use of  Type.IsAssignableFrom()) on the .NET framework is maybe 
faster that getInterfaces() methods of Java.

Even if benchmarks are ok, the "problem" of the order of insertion of 
AttributeRenderer remains. Current version use a Map to store 
AttributeRenderer, allowing interfaces will need to process 
AttributeRenderer in a fixed/known order.

Do you have some benchmark data/application ?
How can I checkout the last version of sources to test it by myself ?

Thanks

Vincent


Sam Harwell wrote:
>
> 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/20091023/9b71c7be/attachment.html 


More information about the stringtemplate-interest mailing list