-
-
Notifications
You must be signed in to change notification settings - Fork 215
Divide and conquer less threads #597
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
Divide and conquer less threads #597
Conversation
e64c1fe
to
da909eb
Compare
I did evaluate this before, and got better throughput by "waisting" threads like this. (Maybe I was mistaken or maybe things have changed, it was a long time now – could re-investigate this.) Perhaps it's time to run some of the (subclasses of) AbstractThresholdTuner benchmarks again. In the end, I suppose, it's the results of the benchmarks in https://github.com/optimatika/ojAlgo-linear-algebra-benchmark that matter. |
I agree, accepting it should depend on the benchmark results produced. Result might depend on what java version the benchmark use. I will look at those tests you mention. |
da909eb
to
b7cfdeb
Compare
2c2f3da
to
ce41ecb
Compare
ac7391c
to
da518a2
Compare
…is' tread, instead of letting 'this' tread wait.
c3dd266
to
61bd57e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Inconsistent Exception Handling in DivideAndConquer
The commit introduces inconsistent exception handling in the DivideAndConquer
class. The second part of the operation is now called directly, while the first part remains asynchronous via a Future
. Previously, all exceptions were consistently wrapped in ExecutionException
and re-thrown as RuntimeException
. Now, unchecked exceptions from the directly called second part bypass the catch
block (which only handles InterruptedException
and ExecutionException
), propagating unwrapped. This creates inconsistent error handling compared to the first part, which still wraps exceptions in RuntimeException
.
src/main/java/org/ojalgo/concurrent/DivideAndConquer.java#L89-L95
ojAlgo/src/main/java/org/ojalgo/concurrent/DivideAndConquer.java
Lines 89 to 95 in 61bd57e
try { | |
DivideAndConquer.call(executor, split, limit, threshold, nextWorkers, conquerer); | |
firstPart.get(); | |
} catch (final InterruptedException | ExecutionException cause) { | |
throw new RuntimeException(cause); | |
} |
Was this report helpful? Give feedback by reacting with 👍 or 👎
Describe the PR
Divide and conquer can use 'this' thread instead of creating a second thread and then wait for the two new ones to finish their tasks.
Test Cases
I only run the normal ojAlgo tests and only the testReading1BRC failed as it did for me before this patch.
I hope this will improve benchmarks slightly, but I do not know which to run.