[stringtemplate-interest] caching getter lookup speedup
Udo Borkowski
ub at abego-software.de
Mon Dec 27 11:35:03 PST 2010
Good work!
I guess I can now drop my PropertyAdapter stuff and switch to the new ModelAdaptor feature.
Just a minor thing: when looking for a "by method" implementation of a property you check for the methods "getXXX" and "isXXX". While this is exactly as defined for JavaBeans I found it useful also to check for a method named "XXX". This will also cover properties like "hasFocus", "hasParameters", or even "initialValue" implemented by methods "hasFocus()", "hasParameters()" or "initialValue()".
With this extension to the semantic of the ObjectModelAdapter guys like Rafael would not need to write their own Adapter but could just refer to every parameterless method of the "bean" as a "property" in their template.
Apropos "parameterless": After finding a method (in getProperty()) only parameterless object methods should be accepted.
Udo
On 26.12.2010, at 20:59, Terence Parr wrote:
> ok, added benchmarking code to v4. Tested speed with and w/o Method/Field caching. about 10x improvement. Average units of work went from 32.77 to 395.22. This is a micro benchmark for property lookup.
>
> timeSimplePropsOfArgs : 395.24 402.13 399.98 369.82 408.94 = 395.22 units of work / ms
>
> timeSimplePropsOfArgs : 32.63 32.74 32.68 32.95 32.83 = 32.77 units of work / ms
>
> Now I'm optimizing local attribute (arg) access. Sam Harwell will be happy :) I'll check those numbers after impl.
>
> Ter
> _______________________________________________
> stringtemplate-interest mailing list
> stringtemplate-interest at antlr.org
> http://www.antlr.org/mailman/listinfo/stringtemplate-interest
More information about the stringtemplate-interest
mailing list