News for hackers. Stuff that matters.
Re:Clojure-Scheme by radarsat1 on Friday April 06, 2012 @01:23PM (#3808026)
This is very cool. I like the idea of compiling to scheme.

Although: 1.1 seconds for clojure repl, 0.8 seconds for gsc-compiled version. That's actually less of a difference in speed than I'd expected. Not being very familiar with ClojureScript, is this clojure repl running in the JVM or in V8?

Edit: on that note, it'd be interesting to compare timing after compiling with Stalin.

Re:Clojure-Scheme by lukev on Friday April 06, 2012 @01:51PM (#3808137)
It's not clear if the 1.1 seconds figure is from the Clojure repl or the ClojureScript repl. They're very different.

It says "Clojure" Repl, and in that case it would be running directly on the JVM.

Re:Clojure-Scheme by takeoutweight on Friday April 06, 2012 @04:12PM (#3808706)
I was running in the JVM Clojure repl (and not timing JVM startup time). But this is just a single microbenchmark of the author's choosing so we are right to be suspicious of it!

Does anyone know of a collection of Clojure benchmarks that stress various aspects of the runtime? (garbage collection, immutable update, polymorphism, etc.)

Re:Clojure-Scheme by babebridou on Friday April 06, 2012 @02:44PM (#3808359)
I wondered, too, so I ran the benchmark on a clojure repl on the JVM on my desktop, it timed at 1028ms.
Re:Clojure-Scheme by amouat on Friday April 06, 2012 @03:01PM (#3808424)
Unfortunately that doesn't tell us a lot, unless you also do each of the other timings.
Re:Clojure-Scheme by babebridou on Friday April 06, 2012 @04:49PM (#3808869)
You're right, that was my plan actually, but I got sidetracked by the cygwin beast, sorry.

I timed the fib(36) function from within a clojurescript repl inside a clojure jvm repl, and it returned in 86 seconds.

Then I timed the generated js function in a Chrome console with a not-so-minor modification so it would compile, it returned in 13 seconds. The modification in question was inlining the generated cljs.core.truth_(predicate) javascript function.

The orders of magnitude don't lie though - for what it's worth, a recursive fibonacci implementation in plain java returns in about 125ms (and depending on jvm warm-up, an array-backed computation is a merry jog of 50 to 300µs, but that's completely off-topic)

I have yet to setup gambit and clone the clojure-scheme project. I'm really curious though, I like these 800ms that the author advertises.

Re:Clojure-Scheme by reddit_clone on Friday April 06, 2012 @01:58PM (#3808172)
I wonder what would be the timing for a small compiled Gambit program doing the same calculation...

Clojure is probably bringing in some start-up overhead. If it is indeed just a start-up overhead, it would be less of a problem.

Crazy stuff.

Re:Clojure-Scheme by takeoutweight on Friday April 06, 2012 @04:18PM (#3808732)
I haven't done any rigorous benchmarking, but I suspect clojure-scheme introduces little overhead above what Gambit requires. I'm able to lean on native Gambit gambit constructs for quite a bit (i.e. Gambit records underpin Clojure deftypes).
Re:Clojure-Scheme by moonchrome on Friday April 06, 2012 @01:33PM (#3808077)
IIRC it's running JVM/Rhino with the repl you start using scripts/repl.
Re:Clojure-Scheme by swannodette on Friday April 06, 2012 @01:38PM (#3808090)
ClojureScript also ships with a browser REPL which uses a browser's JS engine as the evaluation environment. It's simple to swap in new evaluation environments - I got a basic Node.js ClojureScript REPL working without much effort.