On Wed, Feb 10, 2010 at 2:53 AM, Hugo Palma <[email protected]> wrote:

> Again,
> the only reason i raised this question it's because i was alarmed by what
> the wiki page about reflection snippets says:
>
> "works perfectly for development / low volume deployment, however when
> your site starts to scale this method of snippet modeling may become
> undesirable."
>
> All i would like is some clarification if this statement is in fact true,
> if not i will go on with my project happily using reflection snippets. If it
> is true i then would be looking for a better alternative.
>

It is much better practice in my opinion to use an explicit dispatch.  But
you do whatever you want.  If it becomes a performance problem for you and
you're on a production site, then we'll look at it.

More broadly, we like to help newbies and folks with live production sites.
But, we also expect that newbies will bring us real issues that they
themselves are facing, not premature optimizations.  We have limited time to
help people and wasting (and this thread has crossed seriously into
time-wasting land) time with stuff that doesn't really impact you means that
(1) you will get a lot less attention in the future (think the boy who cried
wolf) and (2) it lowers the quality of discussion for the rest of the folks
on the list.

Net-net: if you like using snippets by reflection, then go right ahead.  If
you want features in Lift, don't take a dogmatic approach, but look at
what's there already.


>
> On Wed, Feb 10, 2010 at 06:56, Naftoli Gugenheim <[email protected]>wrote:
>
>> Besides, would it even help? Is the time in obtaining a Method instance
>> rather than invoking it?
>>
>> -------------------------------------
>> David Pollak<[email protected]> wrote:
>>
>> On Tue, Feb 9, 2010 at 9:10 AM, Hugo Palma <[email protected]>
>> wrote:
>>
>> > Why doesn't Lift create the mapping at startup using reflection ?
>> > It's not using reflection that's the problem, it's using reflection at
>> > runtime for every single snippet usage.
>> >
>>
>> Why do you care?  The cost of doing a method dispatch via reflection is
>> about 5x the cost of a doing a method call on an interface with is about
>> 2x
>> more costly than doing a method call on a class.  The amount of time to do
>> reflection on the 10 or 20 snippets you may have on a page is unmeasurably
>> small compared to the cost of rendering the page.
>>
>>
>> >
>> > I may be over simplifying things, but if at startup Lift would go
>> > through all snippet classes and using reflection found all the methods
>> > kept all the mappings somewhere in memory i think it could work.
>> > Is this doable ?
>> >
>>
>> No, it is not possible at start-up time to determine all the classes that
>> might be snippets.
>>
>>
>> >
>> > On 9 Fev, 17:01, Timothy Perrett <[email protected]> wrote:
>> > > So you don't want to write any explicit mapping, and you don't want to
>> > use reflection??? How would you propose Lift know what your asking for?
>> > >
>> > > Im afraid voodoo is not yet compatible with the JVM ;-)
>> > >
>> > > Cheers, Tim
>> > >
>> > > On 9 Feb 2010, at 16:54, Hugo Palma wrote:
>> > >
>> > >
>> > >
>> > > > I just readhttp://wiki.github.com/dpp/liftweb/about-snippetsand i
>> > > > have the following question:
>> > >
>> > > > So is really the only way to avoid having a reflection call every
>> time
>> > > > you use a snippet to use a DispatchSnippet with a case statement for
>> > > > every method ?
>> > > > It's just that i don't really think that the case is a very clean
>> way
>> > > > of doing things. Can be ok for a couple of methods but it can be
>> > > > really ugly with more than that.
>> > >
>> > > > So, is there any other way ?
>> > > > Thanks.
>> > >
>> > > > --
>> > > > You received this message because you are subscribed to the Google
>> > Groups "Lift" group.
>> > > > To post to this group, send email to [email protected].
>> > > > To unsubscribe from this group, send email to
>> > [email protected]<liftweb%[email protected]>
>> <liftweb%[email protected]<liftweb%[email protected]>
>> >
>> > .
>> > > > For more options, visit this group athttp://
>> > groups.google.com/group/liftweb?hl=en.
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> Groups
>> > "Lift" group.
>> > To post to this group, send email to [email protected].
>> > To unsubscribe from this group, send email to
>> > [email protected]<liftweb%[email protected]>
>> <liftweb%[email protected]<liftweb%[email protected]>
>> >
>> > .
>> > For more options, visit this group at
>> > http://groups.google.com/group/liftweb?hl=en.
>> >
>> >
>>
>>
>> --
>> Lift, the simply functional web framework http://liftweb.net
>> Beginning Scala http://www.apress.com/book/view/1430219890
>> Follow me: http://twitter.com/dpp
>> Surf the harmonics
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Lift" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected]<liftweb%[email protected]>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/liftweb?hl=en.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Lift" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected]<liftweb%[email protected]>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/liftweb?hl=en.
>>
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Lift" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<liftweb%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/liftweb?hl=en.
>



-- 
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Surf the harmonics

-- 
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en.

Reply via email to