http://shootout.alioth.debian.org/u64q/benchmark.php?test=al... Median speedup for the same problem in Clojure was 12x over Ruby. and 14x for Haskell; ... and 25x in Java .. and 35x in C++...
Unfortunately the cost of developing this solution in C++ would be forbidding for us. In our case on the pretty much same loop the difference between Ruby and Clojure was 20-30 times. Please note that using Clojure allowed us direct access to Java libraries, so essentially this is Java performance that we've been able to tap into using Clojure.
Our experience using Clojure to speed up Beanstalk
61–70 of 75 posts
Re: Our experience using Clojure to speed up Beanstalk
#62Earlier quoted context omitted.
Unfortunately the cost of developing this solution in C++ would be forbidding for us. In our case on the pretty much same loop the difference between Ruby and Clojure was 20-30 times. Please note that using Clojure allowed us direct access to Java libraries, so essentially this is Java performance that we've been able to tap into using Clojure.
did you try doing the same using jruby?
Another plus for Clojure is that it allows us to easily have a multi-threaded implementation. JRuby allows native threads too, but Clojure make concurrency really easy, while JRuby just wraps Java threads with nothing more, so I would have to use regular locking and stuff.
Re: Our experience using Clojure to speed up Beanstalk
#63Earlier quoted context omitted.
Lines of code is the new form of premature optimization. A C solution is better in performance and compatibility, but you've prematurely optimized on lines of code as your deciding factor (based on you mentioning it in the article, and again here). Obviously, you can choose whatever you like, it's your company. I'm just explaining what the best solution was for the many students and young programmers who visit hacker…
They're optimizing for their business value and resources (programmers) available. It might not impress their programmer friends, but it'll impress their accountant.
Re: Our experience using Clojure to speed up Beanstalk
#64Earlier quoted context omitted.
Those same students and programmers should realize that yours is just one opinion among many. Your advice leans toward the "fungible cogs" school, where the capital crime is to expect others to learn something they don't already know. That's still a widely held view, and maybe even a majority, but probably not on HN. (see pg's Beating the Averages essay: http://www.paulgraham.com/avg.html )
> Your advice leans toward the "fungible cogs" school, where the capital crime is to expect others to learn something they don't already know. Not following what you mean. Do you mean that I do expect people to learn stuff, or that I don't expect them to learn stuff in order to do their job?
Favoring "little to no new concepts" at least suggests a bias against certain kinds of learning. Sometimes learning a new concept is the best way to solve a problem.
Re: Our experience using Clojure to speed up Beanstalk
#65Earlier quoted context omitted.
Have you seen Leiningen[1]? It pretty much solves packaging and deploying problem. Awesome tool. Also if you're into Web development, I can recommend playing with Noir[2] framework and Korma[3] for SQL abstraction. Heroku also support deploying Clojure apps out of the box, so you can easily use a free tier to get something out there. [1] https://github.com/technomancy/leiningen [2] http://webnoir.org/ [3] http://sqlk…
I've got a question about Noir. Is it necessary for me to write HTML with Clojure, or can I separate it and write plain HTML somehow? Writing HTML in the middle of my Clojure code doesn't appeal to me coming from a MVC background...
(html
(head (title "My page")
(script :type "text/javascript" :src "/static/page.js"))
(body (p "Stuff")))
Actually for a while I had a JS tool which I was using called "build.js" which would just build DOM components like this. (It was therefore JSON-serializable too, but I never really had an occasion to use that.)There is something nice about HTML which is a bit lost here: HTML (and LaTeX for that matter) allow unquoted text, with fewer escape characters. They are markup languages, which s-expressions crucially lack. (On the other hand, XML & family lack the ability of Lisps to make the first token anything other than a symbol.) There was briefly a plot called NML / Enamel and some others -- DTML and TML I believe -- which would instead write:
>>
>>
This is actually an emulation of a C-type syntax with a Lisp-type semantics: the idea is that you have in some sense two syntactically different channels into your expressions, one which comes before the pipe character | and one that comes after. The stuff that comes after is allowed to be marked-up text; the stuff that comes before is some sort of node list, and perhaps has certain conventions (one could imagine instead using a Clojure-style `:type "text/javascript"`, which would limit you to what XML attributes can do -- short text only, symbolic keywords).That is, one could hypothetically rewrite this in some C-ish syntax which would look like:
html {
head { title { My page }
script(type {text/javascript} src {/static/page.js}) {}}
body { p { Stuff }}}
and again, if you wanted to limit yourself to XML, the parens above could then say instead `type: "text/javascript" src: "/static/page.js"` but it doesn't have to be that way.Some crazy ideas for anyone building a new language to think about.
Re: Our experience using Clojure to speed up Beanstalk
#66Earlier quoted context omitted.
I'm not going to back up these claims in any other way than pointing the "interesting alternative" programs that appear in some comparisons, which tend to be faster than the chosen versions. For example here: http://shootout.alioth.debian.org/u64q/benchmark.php?test=fa... Both Lisp and Java alternatives are faster than the "fastest" solution (written in Fortran). Finding any more support for the years-old opinion I v…
So we can immediately dismiss your "Programs are not meant to be written in idiomatic language. They are meant to resemble the C implementation." claims as baseless . The only example you chose shows programs that manually unroll loops are not accepted. (And that's stated explicitly on the Help page. http://shootout.alioth.debian.org/help.php#unroll )
Re: Our experience using Clojure to speed up Beanstalk
#67Earlier quoted context omitted.
So we can immediately dismiss your "Programs are not meant to be written in idiomatic language. They are meant to resemble the C implementation." claims as baseless . The only example you chose shows programs that manually unroll loops are not accepted. (And that's stated explicitly on the Help page. http://shootout.alioth.debian.org/help.php#unroll )
Yes, you can. Just one last mention: my opinion was formed in the times I used Perl and looked around the actual implementations of these. But that was years ago. It was reinforced quite recently by someone whining (probably on HN) about the same things. Apart from these anecdotes, I have no basis for these words.
It's a sad nuisance when people opine without checking what's actually shown on a public website.
It's sad to see fact based comments being down voted on HN.
Re: Our experience using Clojure to speed up Beanstalk
#68Earlier quoted context omitted.
I'm not going to back up these claims in any other way than pointing the "interesting alternative" programs that appear in some comparisons, which tend to be faster than the chosen versions. For example here: http://shootout.alioth.debian.org/u64q/benchmark.php?test=fa... Both Lisp and Java alternatives are faster than the "fastest" solution (written in Fortran). Finding any more support for the years-old opinion I v…
So we can immediately dismiss your "Programs are not meant to be written in idiomatic language. They are meant to resemble the C implementation." claims as baseless . The only example you chose shows programs that manually unroll loops are not accepted. (And that's stated explicitly on the Help page. http://shootout.alioth.debian.org/help.php#unroll )
(Except for meteor-contest.)
Re: Our experience using Clojure to speed up Beanstalk
#69Earlier quoted context omitted.
Yes, you can. Just one last mention: my opinion was formed in the times I used Perl and looked around the actual implementations of these. But that was years ago. It was reinforced quite recently by someone whining (probably on HN) about the same things. Apart from these anecdotes, I have no basis for these words.
> But that was years ago. It's a sad nuisance when people opine without checking what's actually shown on a public website. It's sad to see fact based comments being down voted on HN.
Well, I could simply ignore the question. Or give the answer I got a few years ago, what I did...
> It's sad to see fact based comments being down voted on HN.
Fact based? More like facts querying. Which is the reason I upvoted every single of your comments...
Re: Our experience using Clojure to speed up Beanstalk
#70Earlier quoted context omitted.
> But that was years ago. It's a sad nuisance when people opine without checking what's actually shown on a public website. It's sad to see fact based comments being down voted on HN.
> It's a sad nuisance when people opine without checking what's actually shown on a public website. Well, I could simply ignore the question. Or give the answer I got a few years ago, what I did... > It's sad to see fact based comments being down voted on HN. Fact based? More like facts querying. Which is the reason I upvoted every single of your comments...
And yet people have down voted.