[stringtemplate-interest] it's 60% of time in ObjectModelAdaptor.getProperty()
Terence Parr
parrt at cs.usfca.edu
Sat Feb 5 09:23:07 PST 2011
Hi Johan, good idea. Still though, w/o a type, it's still got to use .invoke. There is no interface that covers every field / method in all possible incoming objects.
Ter
On Feb 4, 2011, at 11:24 PM, Johan Stuyts wrote:
>> yeah,I like the idea a lot too, but I'm also worried about the tools.jar
>> thing.
>>
>> when it comes down to it, ST v3 was the fastest in the world but it
>> worked for most people. STv4 is at least two times faster so I think
>> perhaps we can just leave it is as-is for now. The easier thing to do
>> might be to generate Java code from the templates and give people a jar
>> to include in their application. The only problem is dynamic field and
>> method eval is still there. without static types, I'm not sure there's a
>> real reason to add the complexity of generating java.
>
> You may also consider using a custom class loader. The only thing you
> would have to do is replace a number of byte strings in a byte array for
> each adapter, and then use defineClass(...):
> - build the byte array by concatenating template parts and
> instance-specific parts
> - tell the custom class loader to define the class
> - use newInstance() on the resulting class
> - cast the object to the interface you have defined for this purpose
> - invoke the method
>
> Johan
> _______________________________________________
> 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