threadly/threadly — pull request #117 by jentfoo (2014-11-18 04:17:19+00:00)
Title: Improved performance for NoThreadScheduler

This is a significant performance improvement for the NoThreadScheduler. It is extremely improved for just simple executions, but it actually is faster for scheduled and recurring tasks too (probably due to smarter locking/notification). I created the following benchmark to compare the implementations:

https://github.com/threadly/threadly_benchmarks/blob/master/src/main/java/org/threadly/concurrent/benchmark/NoThreadSchedulerBenchmark.java

This is about twice as fast for scheduling, and thousands of times faster for simple just .execute() calls. The down sides are:
* Increased memory usage due to two queue structures which have to be used
* Increased complexity in locking and queue management
* We can no longer tolerate scheduleAtFixedRate with a period of zero. I changed it consistently throughout the project to disallow this. FWIW, java.util.concurrent never allowed this, I was only allowing it because it was not a significant issue. I don't think this is a problem (it's kind of a bad design pattern if anyone were to do it).