Care to elaborate which part is out of date?

On Apr 26, 1:48 am, David Nolen <dnolen.li...@gmail.com> wrote:
> Which is out of date.
>
>
>
>
>
>
>
> On Thu, Apr 25, 2013 at 12:47 PM, Alice <dofflt...@gmail.com> wrote:
> > Found this blog post written by fogus:
>
> > "To provide this level of flexibility Clojure establishes a level of
> > indirection. Specifically, all function lookups through a Var occur,
> > at the lowest level, through an atomic volatile. This happens every
> > time that a function bound using the def/defn special forms is called.
> > This indirection is not amenable to HotSpot optimizations."
>
> >http://blog.fogus.me/2011/10/14/why-clojure-doesnt-need-invokedynamic...
>
> > On Apr 25, 10:19 pm, Alice <dofflt...@gmail.com> wrote:
> > > I create many small methods in java without worrying about the
> > > performance since it's usually the target of inline optimization. For
> > > example,
>
> > > public class Foo {
> > >   public static long inc(long l) {
> > >     return ++l;
> > >   }
>
> > >   public static long f1() {
> > >     long l = 0;
> > >     for (int i=0; i < 1000000000; i++) {
> > >       l++;
> > >     }
> > >     return l;
> > >   }
>
> > >   public static long f2() {
> > >     long l = 0;
> > >     for (int i=0; i < 1000000000; i++) {
> > >       l = inc(l);
> > >     }
> > >     return l;
> > >   }
>
> > > }
>
> > > (time (Foo/f1))
> > > (time (Foo/f1))
> > > (time (Foo/f1))
> > > (time (Foo/f2))
> > > (time (Foo/f2))
> > > (time (Foo/f2))
>
> > > "Elapsed time: 23.309532 msecs"
> > > "Elapsed time: 23.333039 msecs"
> > > "Elapsed time: 21.714753 msecs"
> > > "Elapsed time: 22.943366 msecs"
> > > "Elapsed time: 21.612783 msecs"
> > > "Elapsed time: 21.71376 msecs"
>
> > > But clojure funtions seem to be never get inlined.
>
> > > (def obj (Object.))
>
> > > (defn getObj [] obj)
>
> > > (defn f1 [] obj)
> > > (defn f2 [] (getObj))
>
> > > (time (dotimes [n 100000000] (f1)))
> > > (time (dotimes [n 100000000] (f1)))
> > > (time (dotimes [n 100000000] (f1)))
> > > (time (dotimes [n 100000000] (f2)))
> > > (time (dotimes [n 100000000] (f2)))
> > > (time (dotimes [n 100000000] (f2)))
>
> > > "Elapsed time: 67.758744 msecs"
> > > "Elapsed time: 68.555306 msecs"
> > > "Elapsed time: 68.725147 msecs"
> > > "Elapsed time: 104.810459 msecs"
> > > "Elapsed time: 103.273618 msecs"
> > > "Elapsed time: 103.374595 msecs"
>
> > --
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Clojure" group.
> > To post to this group, send email to clojure@googlegroups.com
> > Note that posts from new members are moderated - please be patient with
> > your first post.
> > To unsubscribe from this group, send email to
> > clojure+unsubscr...@googlegroups.com
> > For more options, visit this group at
> >http://groups.google.com/group/clojure?hl=en
> > ---
> > You received this message because you are subscribed to the Google Groups
> > "Clojure" group.
> > To unsubscribe from this group and stop receiving emails from it, send an
> > email to clojure+unsubscr...@googlegroups.com.
> > For more options, visithttps://groups.google.com/groups/opt_out.

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to