Besides, would it even help? Is the time in obtaining a Method instance rather 
than invoking it?

-------------------------------------
David Pollak<feeder.of.the.be...@gmail.com> wrote:

On Tue, Feb 9, 2010 at 9:10 AM, Hugo Palma <hugo.m.pa...@gmail.com> 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 <timo...@getintheloop.eu> 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 lift...@googlegroups.com.
> > > To unsubscribe from this group, send email to
> liftweb+unsubscr...@googlegroups.com<liftweb%2bunsubscr...@googlegroups.com>
> .
> > > 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 lift...@googlegroups.com.
> To unsubscribe from this group, send email to
> liftweb+unsubscr...@googlegroups.com<liftweb%2bunsubscr...@googlegroups.com>
> .
> 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 lift...@googlegroups.com.
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com.
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 lift...@googlegroups.com.
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en.

Reply via email to