Clojure 1.8 Improves Performance and Development Experience

| by Abraham Marín Pérez Follow 9 Followers on Jan 27, 2016. Estimated reading time: 2 minutes |

Earlier this month, Alex Miller, one of the main developers behind the Clojure Community, announced the latest version of Clojure. The flagship new features of Clojure 1.8 are Direct Linking, String Functions and Socket Servers, although it also includes a few minor enhancements and more than thirty bug fixes.

Clojure, a modern dialect of the primordial Lisp programming language, originally debuted in October 2007 and offered its first stable release in 2009. Since then, it has adopted a release cadence of approximately one per year, although recent comments indicate a target of a new release every 6 months.

The three new main features are rather unrelated to each other, but they provide important benefits to Clojure users. On one side, Direct Linking can improve performance by making direct static calls to other functions, as opposed to using the usual two-step indirection. This also allows the JVM to optimise code through JIT (Just In Time) compilation. One downside of this approach is that the dynamism of the method is lost, so methods cannot be redefined during execution. However, the flag can be turned off selectively for any given function by marking it with the metadata "^redef" annotation. Version 1.8 turns on that flag for all functions in Clojure core by default.

On the other hand, a number of native String Functions have been added: index-of, last-index-of, starts-with?, ends-with? and includes?. Prior to this, this functionality was only available by calling the Java String methods directly (via the Java native interoperability known as Java Interop). In contrast with the objective of Direct Linking, the new String Functions are actually slightly slower than the existing alternative. However, the ease of development these functions provide made this one of the most popular Clojure JIRA tickets with 29 votes. They have also been added to ClojureScript.

Finally, the new Socket Server functionality allows the developer to create a socket server for any Clojure application by simply providing a function name as an argument on the command line or in a configuration file. This, together with the new clojure.core.server/repl function, can be used to interact with a running application for debugging or development purposes, since the REPL module will be able to inspect values and even redefine functions in runtime. However, this feature is less likely to be used in production environments for two reasons: first, because of the obvious security concern of having an open server that allows interacting with a running application, and second, because if Direct Linking is enabled (and it's likely to be enabled if performance is a concern), then redefinition of methods won't work, which diminishes the value of the REPL server.

In addition these features, Clojure 1.8 includes a vast array of other changes that can be checked in the official release notes.

Rate this Article

Adoption Stage

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread
Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread


Login to InfoQ to interact with what matters most to you.

Recover your password...


Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.


More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.


Stay up-to-date

Set up your notifications and don't miss out on content that matters to you