Hacker News new | ask | show | jobs
by Zak 4822 days ago
A note about Compojure: they're using Korma for database access. Korma is an abstraction layer that's more Clojure-friendly than using SQL directly, but lighter than an ORM. Using clojure.java.jdbc might produce higher performance.
2 comments

Where possible on the tests, we tried to use something other than raw SQL because we wouldn't expect someone to use raw SQL everywhere when writing a real application. We chose Korma because it seemed decently popular for Clojure, but we're certainly open to a "compojure-raw" test that uses clojure/java.jdbc. Feel free to submit a pull request. :)
I'm not saying Korma isn't a good or realistic choice. I use it myself. There did seem to be some disagreement in freenode #clojure about whether that was the best way to go, or JDBC and prepared statements. Evidently, a lot of people actually do like SQL.

It's just important for people to be aware that "Compojure" actually represents "one possible production-ready stack that uses Compojure as the routing component", as do several other items on the list. I don't mean that as a criticism - just clarification.

The performance of Compojure was really impressive, which was almost three times as fast as play-scala. I was expecting the opposite, considering that Scala is generally a bit faster than Clojure.
From what little I know about Play, it does a lot more than Compojure does. Compojure is really just a routing library. This is a benchmark of Ring (HTTP communication), Compojure (routing), Korma (database access/abstraction) and Cheshire (JSON serialization). I'm pretty sure a basic request in Play goes through more middleware than that.

But yes, the performance of a reasonable web app stack on Clojure is very good.