I've read a lot of interesting stuff about swarm-intelligence and a couple of weeks ago the idea suddenly came to implement something in Clojure. The full source code is in Github (the application can be run from the app.clj), here I'd like to show how the story has evolved step by step. The first part of the task was to implement some kind of "vector algebra" to model the moves of entities.
Thursday, 27 November 2014
Monday, 24 November 2014
Procuder-consumer example in Java and Clojure
I want to implement a very simply consumer-producer app. One consumer consuming from a large number of producers. I would like to see how much throughput is possible in accordance with the number of producers.
The first implementation is in Java
The Clojure version
The Java one is really struggling under 100 producers. I haven't done any tuning on the ExecutorService, though, but in the Clojure version I didn't even need to. The latter is distributing the load extremely evenly and reaches a much higher throughput than the Java version.
The first implementation is in Java
The Clojure version
The Java one is really struggling under 100 producers. I haven't done any tuning on the ExecutorService, though, but in the Clojure version I didn't even need to. The latter is distributing the load extremely evenly and reaches a much higher throughput than the Java version.
Labels:
Clojure
,
core.async
Thursday, 6 November 2014
Dynamic typing - Timeout
Another piece of useful functionality made easy by dynamic typing and clojure.async. Adding a timeout to a function.
Labels:
Clojure
,
Dynamic typing
Subscribe to:
Posts
(
Atom
)