[stringtemplate-interest] caching getter lookup speedup
Rafael Chaves
rafael at alphasimple.com
Mon Dec 27 12:01:37 PST 2010
Hi Udo,
I think adding exact method name matching would be useful and safe, in
addition to the existing JavaBeans style conventions. The use of a
"hasXXX" convention, as you say, is non-standard, and seems
unnecessary IMO (if you already support exact method name match, it is
just a matter of using "hasXXX" as the property name in your
templates).
I agree that method matching name would free folks to adapt when all
they needed is to affect the mapping of property names to methods
names.
As an aside, I still need to implement adapters in my case as my needs
are not limited to mapping property names to methods, I do need to
provide additional properties not directly supported by the model and
that cannot be computed in the template either.
Cheers,
Rafael
On Mon, Dec 27, 2010 at 11:35 AM, Udo Borkowski <ub at abego-software.de> wrote:
> 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
>
> _______________________________________________
> 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