That's really cool. I'm glad someone got it to work and with little
modification!

On Jul 15, 4:21 pm, Joel Dice <joel.d...@gmail.com> wrote:
> (sorry about the lack of subject in my original post; I've added one to
> this email)
>
> On Fri, 15 Jul 2011, George Jahad wrote:
> > very cool Joel!   I'd also be interested in start up time of avian vs.
> > hotspot, i.e. does avian make it viable to use clojure for short,
> > quick scripts?
>
> Possibly.  By default, Avian is noticeably slower to start up than
> Hotspot, at least when using OpenJDK's class library.  The boot process
> for that library touches a lot of code in a lot of classes, and Hotspot
> has several performance advantages to make quick work of it.  On the other
> hand, Avian can also be built to use its own class library, which allows
> much faster startup.  Unfortunately, it doesn't currently have all the
> classes needed to support Clojure, and I haven't checked to see how much
> would need to be added to make it work.
>
> Avian also supports ahead-of-time compilation from Java bytecode to native
> machine code, so it would be possible to create an executable with all the
> OpenJDK and Clojure classes precompiled, thereby bypassing the need for
> JIT compilation at runtime except for dynamically-loaded classes.  That
> would be faster, but I'm not sure by how much.
>
> The ideal approach in terms of startup time would be to add whatever
> classes needed to Avian's class library to support Clojure, use ProGuard
> to shrink and optimize the combination of clojure.jar and the system class
> library, and precompile the result into native code.  I might take a stab
> at that if I have time.
>
>
>
>
>
>
>
>
>
> > On Jul 15, 11:59�am, Joel Dice <joel.d...@gmail.com> wrote:
> >> Hi all,
>
> >> I thought I'd share the results of a fun little excercise I did this
> >> morning: running Clojure on a VM with native support for tail call
> >> optimization and first class continuations. �Any Schemers on this list
> >> will probably appreciate it.
>
> >> The VM in question is Avian (http://oss.readytalk.com/avian/), built with
> >> optional tail call and continuation features enabled and using the OpenJDK
> >> class library. �It's not nearly as fast or sophisticated as e.g. Hotspot,
> >> but it has some features that make it interesting for running non-Java
> >> languages. I'm using the latest commit from the Git repository.
>
> >> For example, here's what happens if you recurse too deeply using Hotspot:
>
> >> � $ java -cp clojure.jar clojure.main
> >> Clojure 1.2.1
> >> user=> ((fn this [n] (if (= n 1000000) n (this (+ n 1)))) 0)
> >> java.lang.StackOverflowError (NO_SOURCE_FILE:0)
> >> user=>
>
> >> With Avian, there is no overflow, and we also get to play with
> >> continuations:
>
> >> � $ ../avian/build/linux-x86_64-tails-continuations-openjdk-src/avian 
> >> -Xmx512m -cp clojure.jar clojure.main
> >> Clojure 1.2.1
> >> user=> ((fn this [n] (if (= n 1000000) n (this (+ n 1)))) 0)
> >> 1000000
> >> user=> (defn call-cc [function]
> >> � � (avian.Continuations/callWithCurrentContinuation
> >> � � � (reify avian.CallbackReceiver
> >> � � � � (receive [_ continuation]
> >> � � � � �(function (fn [result] (.handleResult continuation 
> >> result)))))))
> >> #'user/call-cc
> >> user=> (call-cc (fn [continuation] (continuation "hello, world!")))
> >> "hello, world!"
> >> user=>
>
> >> For more information about how continuations work in Avian, please 
> >> seehttp://oss.readytalk.com/avian/javadoc/avian/Continuations.html.
>
> >> Anyway, I think this is an interesting experiment since it shows that
> >> if/when tail call and continuation support are integrated into the JVM
> >> officially (http://openjdk.java.net/projects/mlvm/), Clojure could benefit
> >> with few or no modifications.
>
> > --
> > 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 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

Reply via email to