Skip to content

Instantly share code, notes, and snippets.

@megayu
megayu / kafka-clj.pool-impl.clj
Created June 16, 2016 01:57 — forked from gerritjvv/kafka-clj.pool-impl.clj
Performance of ConcurrentLinkedQueue + Semaphore vs atom + persistent_vector for queue implementation
(ns
^{:doc "Concurrent keyed pool implementation using ConcurrentHashMap and ConcurrentLinkedQueue"}
kafka-clj.pool-impl
(:use criterium.core)
(:import (java.util.concurrent ConcurrentLinkedQueue ConcurrentHashMap Semaphore ExecutorService Executors TimeUnit)))
;; add [criterium "0.4.4"] to you're project.clj file
;; then use run-test-cc and run-test-a
;;
;; Results for both ConcurrentLinkedQueue + Semaphore and for atom + vector access is the same