title: What java concurrent blocking collection is most performance friendly?
body: <p>I've read a lot about concurrent queues in Java however I have no clue what to use when the precedence axiom is omitted.</p>
  
  <p>Here is the real-world situation - I implemented my own executor with following properties:</p>
  
  <ul>
  <li><strong>unbounded</strong> ("up to infinity" tasks waiting)</li>
  <li><strong>recursive</strong> (tasks may spawn new tasks into the same task-pool) that's why I can't use Java Executors - waiting for execution at the end causes exception when running task creates new task.</li>
  <li><strong>thread-safe</strong> (multiple threads may add or retrieve a task)</li>
  <li><strong>non-blocking</strong> (in terms of adding new task)</li>
  <li><strong>blocking</strong> (in terms of waiting for execution)</li>
  </ul>
  
  <p>The worker threads are either working on tasks (runnables) or blocked, waiting for a new task to appear in task-pool.</p>
  
  <p>I intend to maximize the performance, so I avoid locks and conditional variables. The real performance, however, isn't good enough (see below)  - using <code>LinkedBlockingQueue</code> as task-pool.</p>
  
  <p>I realized that I actually don't care about which task is executed first, hence queue seems to be overkill. I think some kind of set or "bag" would be sufficient and hopefully faster.</p>
  
  <p><strong>Question:</strong> What collection and/or general approach would you recommend me to use?</p>
  
  <p>My benchmark - I scheduled 1000 tasks, each <code>Thread.sleep(15)</code>. I have measured walltime of running 1000 times the task; then walltime of the executor. The speedup was only slightly above a <em>half of number of threads</em> (measured on 2,4,6,....,48) threads.</p>