Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recursion on ExecutorService with >1 Thread is Slow #711

Closed
benjchristensen opened this issue Dec 31, 2013 · 1 comment
Closed

Recursion on ExecutorService with >1 Thread is Slow #711

benjchristensen opened this issue Dec 31, 2013 · 1 comment

Comments

@benjchristensen
Copy link
Member

Recursion on NewThreadScheduler or ExecutorScheduler with 1 thread is fast. As number of threads increase in the pool it increasingly slows down. My guess is it's adding overhead jumping between threads and/or CPUs and thus having cache misses or something along those lines.

I found this while testing TestRecursionMemoryUsage and trying Schedulers.threadPoolForComputation() versus Schedulers.newThread().

I confirmed that this changes the performance: Executors.newScheduledThreadPool(2) vs Executors.newScheduledThreadPool(1)

The real code uses numCores for that value which is worse.

We need to look at a way of using a thread-pool sized to the number of threads on the machine so we're not launching new threads every time a scheduler is used, but that recursion efficiently uses the same thread.

@benjchristensen
Copy link
Member Author

Removed ExecutorScheduler and replaced with ComputationScheduler that has a pool of event loops: #1048

zsxwing pushed a commit to zsxwing/RxScala that referenced this issue Aug 19, 2014
benjchristensen added a commit to ReactiveX/RxJavaAsyncUtil that referenced this issue Aug 29, 2014
benjchristensen added a commit to ReactiveX/RxJavaComputationExpressions that referenced this issue Aug 29, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant