I wrote an article on how I decided to go with Ruby instead of Clojure a while back. I moved my blog from Wordpress to Jekyll yesterday and think it’s time for an honest update.
Performance and Speed
Clojure and Ruby is often an order of a magnitude faster than Ruby for compute based tasks. This also means most web applications that are written in Clojure will be much faster than Ruby ones. Additionally, Ruby isn’t particularly well suited for an asynchronous application. The trade-off here is on development speed.
Check out the TechEmpower Benchmarks and make your own choices based on what workload fits your application the best.
How To Pick Between Ruby (and Rails) and Clojure
When I say Ruby, I say it with the assumption that you’re going to be using a framework like Rails. The benefits of developer speed when you can just plug in different libraries with Rails is not to be ignored. For the vast majority of applications, starting out with a framework Ruby on Rails is the correct choice.
If most of your developers already know Ruby and you’re building a new website with server side rendered pages, I would go with Ruby. Why? Like I said, speed of development and iteration on the Ruby with Rails side trumps speed of code execution on the Clojure and JVM side. Especially if you’re building something brand new, like a startup or something. Developer familiarity and productivity is not something you can just ignore. Also, frameworks like Rails are great for the CRUD work you have to do for every website. Think forms, databases, and user authentication. I firmly believe Clojure is the wrong tool for this kind of project.
If you’re building an API or service that isn’t computationally intensive, then Ruby is probably the right tool. If this API or service has to do a lot of waiting on network calls, i.e. there’s a need for asynchronicity, then Clojure is the right tool.
If you need to leverage the JVM… then Clojure. Hadoop? Apache Spark? Parallel computing? Clojure is surely the tool here.
If you want to attract better engineers (on average) and retain more talent by spicing things up, then go Clojure.
If you’re building a single page application, then I would lean heavily towards Clojure and Clojurescript. Same language on front-end and back-end and the Clojurescript React.js wrappers are very powerful.