Closed tischi closed 2 years ago
@ctrueden I thought a bit about it and I think we should add a mechanism in the performance test that kills the test if it runs too long and returns a failed test, otherwise it could just hang forever, e.g., on the CI.
Would something like this make sense?
ExecutorService service = Executors.newCachedThreadPool();
Future future = service.submit( myRunnableTest );
boolean success = true;
long startTime = System.currentTimeMillis();
while (!future.isDone()) {
if (System.currentTimeMillis() - startTime > 5000) {
future.cancel(true);
success = false;
break;
}
}
service.shutDown();
assertTrue(success);
@tischi Researching this, I learned that JUnit has a timeout feature built-in; see https://stackoverflow.com/q/57116801/1207769. Would that work for us here?
@ctrueden
That works:
@Test(timeout=5000)
I added it to the tests. From my side I think this could be merged now.
Great, thank you so much!
IntersectionRealInterval
andIntersectionInterval
behave the same asIntervals.intersect
(and thereby improve their performance when intersecting many such intervals)One also needs to fix the performance issue for
UnionRealInterval
andUnionInterval
but this is pending on https://github.com/imglib/imglib2/issues/300 and, depending on the outcome there, it may not be as straightforward to improve the performance. Thus I would do this is in a separate PR.