do it like SafeModel does: Instead of reflecting all the way
That part of SafeModel is slower than LazyModel actually :P
and simply return an AbstractPropertyModel
PropertyModel doesn't have any advantages here, it calls methods per reflection
as LazyModel does.
we rely on the property expression being available
That's supported in LazyModel too:
https://github.com/wicketstuff/core/blob/master/jdk-1.6-parent/wicketstuff-lazymodel/src/main/java/org/wicketstuff/lazymodel/LazyModel.java#L258
Have fun
Sven
On 02/19/2013 10:27 AM, Carl-Eric Menzel wrote:
On Tue, 19 Feb 2013 09:17:55 +0100
Sven Meier <[email protected]> wrote:
I don't see how 'B' can have method #bind(IModel)
Correct, I fixed the example to declare B as LazyModel<B>.
I also saw performance tests which verify that LazyModel is at least
twice faster than PropertyModel.
Not quite:
In my idealized test-case it is at most 2 times *slower* than
PropertyModel. This holds when each LazyModel is "used" (i.e.
getObject() called) at least ten times, e.g. in an Ajax heavy
application where you stay on a single page for a longer time. If
each LazyModel is used once only (e.g. on a stateless page) it might
get up to 5 times slower than PropertyModel. That proxying comes at a
high price, there's no way around it :/. PropertyModel is still the
king of performance. Or you have to switch to a preprocessor solution
like bindgen-wicket.
Or you can do it like SafeModel does: Instead of reflecting all the
way, construct the property expression once and simply return an
AbstractPropertyModel. That would also allow some other tricks (we rely
on the property expression being available in my main project).
Carl-Eric