bonej-org / BoneJ2

Plugins for bone image analysis
BSD 2-Clause "Simplified" License
20 stars 12 forks source link

Anisotropy performance fluctuates wildly #241

Open rimadoma opened 4 years ago

rimadoma commented 4 years ago

The time Anisotropy takes fluctuates randomly between runs. For example, I've seen _bat_cochleavolume.zip take anything between 10 000 and 40 000 ms with the default parameters (directions = 2_000, linesPerDirection = 10_000, samplingIncrement = sqrt(3.0)). Ideally performance would be more consistent.

rimadoma commented 4 years ago

I thought if sometimes MIL sampling was unlucky, and had a lot more misses than at other times. This is not the case, in fact I found out that sometimes execution takes less time with fewer iterations:

Duration: 18169 ms Iterations: 112817664 Misses: 63958158

Duration: 13345 ms Iterations: 112901391 Misses: 64139667

I also checked that the total length of the lines sampled is always the same.

rimadoma commented 4 years ago

I checked with VisualVM that it's not garbage collection kicking in. It's not. What I did notice is that on slower runs CPU usage fluctuates more from the usual ~95 %. Almost all the execution time is spent in ParallelLineMIL.countPhaseChanges() which is to be expected.