Re: EY map reduce contest

2009-07-15 Thread Michael Wood
2009/7/15 John Harrop : > On Wed, Jul 15, 2009 at 4:53 AM, hosia...@gmail.com > wrote: >> >> >> http://www.engineyard.com/blog/2009/programming-contest-win-iphone-3gs-2k-cloud-credit/ >> >> Has anyone got access to hundreds of thousands of machines that I >> could borrow for 30 hours ? ;) > > Don

Re: Examining performance on the JVM

2009-07-15 Thread Glen Stampoultzis
Apparently it's possible to see the assembly instructions if you're running a debug VM [1]. -XX:+PrintOptoAssembly dumps to the console a log of all assembly being generated for JITed methods. The instructions are basically x86 assembly with a few Hotspot-specific instruction names that get replac

Examining performance on the JVM

2009-07-15 Thread Bradbev
I see lots of discussion on this list about Clojure performance & how to get it to Java speed. I am also interested in the next steps that happen, how does the JVM convert byte code down to machine code and how does one examine that? The profiling tools I use for C code let me look at what the co

Re: Performance question (newbie)

2009-07-15 Thread Rich Hickey
On Jul 15, 2:22 pm, John Harrop wrote: > On Wed, Jul 15, 2009 at 11:39 AM, B Smith-Mannschott > wrote: > > > An explicit loop with some type hints is faster, though likely not as > > fast as Java: > > > (defn sum-of-range-4 [range-limit] > >  (loop [i (int 1) s (long 0)] > >    (if (< i range-l

Re: Performance question (newbie)

2009-07-15 Thread Dragan
Guys, thanks very much for the fast responses. Of course, this is an unscientific and totally ad-hock benchmark. I am just *learning* Clojure and functional programming and I wanted to get some feeling of how fast Clojure is comparing to java when equivalent idioms are used . Of course, loop and

Re: Clojure vectors

2009-07-15 Thread John Harrop
On Wed, Jul 15, 2009 at 12:58 PM, Mark Engelberg wrote: > > It looks like stack-rot is going to be the bottleneck in your app > since it requires traversing the whole vector to build the new one, > but I think the list-based implementation would be a bit worse, so I > think your choice to use vecto

Re: EY map reduce contest

2009-07-15 Thread John Harrop
On Wed, Jul 15, 2009 at 4:53 AM, hosia...@gmail.com wrote: > > > http://www.engineyard.com/blog/2009/programming-contest-win-iphone-3gs-2k-cloud-credit/ > > Has anyone got access to hundreds of thousands of machines that I > could borrow for 30 hours ? ;) Don't know any botnet herders; sorry. :)

Re: Performance question (newbie)

2009-07-15 Thread John Harrop
On Wed, Jul 15, 2009 at 11:39 AM, B Smith-Mannschott wrote: > An explicit loop with some type hints is faster, though likely not as > fast as Java: > > (defn sum-of-range-4 [range-limit] > (loop [i (int 1) s (long 0)] >(if (< i range-limit) > (recur (inc i) (+ s i)) > s))) > > This

Re: Clojure vectors

2009-07-15 Thread Chouser
On Wed, Jul 15, 2009 at 6:00 PM, Mark Engelberg wrote: > > On Wed, Jul 15, 2009 at 9:58 AM, Mark Engelberg > wrote: >> The problem with subvec is that it doesn't really create a "new" >> vector, it just adds a level of indirection off of the original >> vector.  So for example, if you look up, sa

Reddit discussion on lazy lists faster than eager

2009-07-15 Thread Vagif Verdi
I got into funny discussion about speed of lazy lists versus eager lists in clojure: http://www.reddit.com/r/programming/comments/91ha3/how_to_start_using_lisp_at_work/c0b44xp I did this small example to test it: user> (time (dorun (map #(+ % 1) (map #(+ % 1) (map #(+ % 1) (repeat 100 7

Re: Clojure vectors

2009-07-15 Thread Mark Engelberg
On Wed, Jul 15, 2009 at 9:58 AM, Mark Engelberg wrote: > The problem with subvec is that it doesn't really create a "new" > vector, it just adds a level of indirection off of the original > vector.  So for example, if you look up, say, index 2 in the subvec, > it knows to go look up index 5 in the

Re: easiest JMX API ever, in Clojure...

2009-07-15 Thread Michael Wood
2009/7/15 Daniel : > > On Wed, Jul 15, 2009 at 3:43 AM, Michael Wood wrote: [...] >> I've never tried this sort of thing before, but I'm trying to connect >> to a JBoss instance with it and not having much luck.  I think I need >> to authenticate somehow, but I have no idea how to do that.  Normal

Re: Clojure emacs formatting of letfn

2009-07-15 Thread Richard Newman
> As a close approximation you can use the workaround > Rayne suggest: place the argument vector on the next > line and you should come close. Yup. I usually end up doing this anyway, because Clojure docstrings come before the argument list. It's certainly not a problem for me. --~--~-

Re: Clojure vectors

2009-07-15 Thread Mark Engelberg
On Wed, Jul 15, 2009 at 3:51 AM, Jan Rychter wrote: > I am not sure what you mean about subvecs, though -- I currently use > them for dropn and rot operations, and I don't know how to avoid using > them: The problem with subvec is that it doesn't really create a "new" vector, it just adds a level

Re: EY map reduce contest

2009-07-15 Thread Cosmin Stejerean
On Wed, Jul 15, 2009 at 3:53 AM, hosia...@gmail.com wrote: > > > http://www.engineyard.com/blog/2009/programming-contest-win-iphone-3gs-2k-cloud-credit/ > > Has anyone got access to hundreds of thousands of machines that I > could borrow for 30 hours ? ;) > > Interesting idea, not sure if anything

Re: Why do Enlive template functions return a seq instead of a str?

2009-07-15 Thread cody koeninger
On Jul 11, 12:31 pm, Jarkko Oranen wrote > Forcing them into a single string at the end would wasteful in case > the user intends to write the output into a stream (which can be done > a fragment at a time.) Thus, leaving the choice to the user seems like > a good decision. > > Or maybe it's just

Re: Performance question (newbie)

2009-07-15 Thread B Smith-Mannschott
On Wed, Jul 15, 2009 at 13:51, Dragan wrote: > > Hi, > > I am trying to compare the performance of java loops to clojure reduce > function. Noting special, Since I am just learning. > Java code is something like: > > [code] > long sum = 0; > for (int i = 1; i < 100; i++ ){ >    sum = sum + i; >

Re: Performance question (newbie)

2009-07-15 Thread Aaron Cohen
Another note is that these kind of micro-benchmarks are a little difficult to do correctly in most modern VMs, including Hotspot. In particular, the kind of tight loop you're doing there where the result isn't used can sometimes be optimized away by the JIT to go "infinitely" fast. A pretty good

Re: Performance question (newbie)

2009-07-15 Thread Adrian Cuthbertson
It's also worth searching this group for 'performance' and checking out the discussions over the past few months. There've been lots of queries about many different aspects of performance and some really good advice dispensed. - Adrian. On Wed, Jul 15, 2009 at 3:39 PM, Frantisek Sodomka wrote: >

Re: Performance question (newbie)

2009-07-15 Thread Frantisek Sodomka
PS: Read tips on: http://clojure.org/java_interop On Jul 15, 1:51 pm, Dragan wrote: > Hi, > > I am trying to compare the performance of java loops to clojure reduce > function. Noting special, Since I am just learning. > Java code is something like: > > [code] > long sum = 0; > for (int i = 1;

Re: Performance question (newbie)

2009-07-15 Thread Frantisek Sodomka
If you make it into a function and use type hints, that should help: (defn sum [n] (let [n (int n)] (loop [ret (long 0) i (int 1)] (if (< i n) (recur (+ ret i) (inc i)) ret user=> (time (reduce + (range 1 100))) "Elapsed time: 116.959837 msecs" 4950 u

Re: Clojure emacs formatting of letfn

2009-07-15 Thread Meikel Brandmeyer
Hi, On Jul 15, 4:47 am, Richard Newman wrote: > Incidentally, VimClojure gets the second part wrong, too (though it   > gets the first correct). I see the problem. However I'm not sure, that fixing it is worth the trouble. At the moment VC only looks at the innermost thing and aligns with that

Re: Performance question (newbie)

2009-07-15 Thread Meikel Brandmeyer
Hi, On Jul 15, 1:51 pm, Dragan wrote: > [code] > long sum = 0; > for (int i = 1; i < 100; i++ ){ >     sum = sum + i;} > > [/code] > > while in Clojure I used: > > [code] > (reduce + (range 1 i)) > [/code] Comparing such a loop with reduce is a bit unfair, since the loop iteration heavily d

Re: Clojure emacs formatting of letfn

2009-07-15 Thread Rayne
It seems that if you put the argument list on the /next/ line, indentation is correct. I can understand how this might not be your desired style, but if you're desperate and don't want to correct indentation yourself it will do. (defn tfunc [] (letfn [(function1 [] (println "test"))

Re: turn a seq into a list

2009-07-15 Thread Meikel Brandmeyer
Hi, On Jul 15, 1:41 pm, Jarkko Oranen wrote: > Essentially, I'm looking for something similar to (vec) that returns > lists. There is also list*. But that returns Cons's not a PersistentList's. Cons is not Counted... Sincerely Meikel --~--~-~--~~~---~--~~ You

Performance question (newbie)

2009-07-15 Thread Dragan
Hi, I am trying to compare the performance of java loops to clojure reduce function. Noting special, Since I am just learning. Java code is something like: [code] long sum = 0; for (int i = 1; i < 100; i++ ){ sum = sum + i; } [/code] while in Clojure I used: [code] (reduce + (range 1 i

Re: NoClassDef Issue, possibly my fault with the classloaders

2009-07-15 Thread Daniel
Resurrection Is this still a problem? If yes, I recommend to look into using an OSGi framework for your classloading. Classloaders are non-trivial and it's very easy to trip, to introduce subtle bugs, or fragile things that break later. Using an established technology for dealing with the problem

Re: easiest JMX API ever, in Clojure...

2009-07-15 Thread Daniel
On Wed, Jul 15, 2009 at 3:43 AM, Michael Wood wrote: > > 2009/7/14 Stuart Halloway : >> >> ...wants your   help to be born! :-) >> >> There is a branch in clojure-contrib that includes work so far: >> http://github.com/richhickey/clojure-contrib/tree/jmx >> . I want feedback on ease of use, most

Re: turn a seq into a list

2009-07-15 Thread Jarkko Oranen
On Jul 15, 1:54 pm, Jan Rychter wrote: > I've been looking for a function that would take a seq and create a list > (a real clojure.lang.PersistentList), but haven't found one. The closest > I got was: > > (apply list my-seq) > > Essentially, I'm looking for something similar to (vec) that return

turn a seq into a list

2009-07-15 Thread Jan Rychter
I've been looking for a function that would take a seq and create a list (a real clojure.lang.PersistentList), but haven't found one. The closest I got was: (apply list my-seq) Essentially, I'm looking for something similar to (vec) that returns lists. --J. --~--~-~--~~

Re: Clojure vectors

2009-07-15 Thread Jan Rychter
Thanks to everyone who replied in this thread. I am impressed by the signal-to-noise ration on this list and by the quality of replies. I will try to reply to everyone in a single post, trying to summarize. > On Jul 13, 11:15 am, Jan Rychter wrote: >> I've been trying to implement stacks using v

EY map reduce contest

2009-07-15 Thread hosia...@gmail.com
http://www.engineyard.com/blog/2009/programming-contest-win-iphone-3gs-2k-cloud-credit/ Has anyone got access to hundreds of thousands of machines that I could borrow for 30 hours ? ;) Interesting idea, not sure if anything but a brute force method is possible ? -- Karol Hosiawa --~--~-

Re: ANN: FnParse, a functional parsing library

2009-07-15 Thread Christian Vest Hansen
Tangentially relevant comment, FYI: You'd be hard pressed to find a JSON parser on the JVM that is faster than Jackson. On Mon, Jul 6, 2009 at 2:55 AM, Wilson MacGyver wrote: > > Thanks for the tip on looking at clojure.contrib. I keep forgetting to > check there. > > On Jul 5, 2009, at 4:20 PM,