You have changed the behavior. Before we were getting only the ruptures associated with the non zero ground shaking nearest to the asset. Now, you always consider all the ruptures for each asset. That means that you are building arrays of length equal to the number of ruptures in the whole calculation (it is actually the worst case).

I am concerned about the net effect. You are wasting a lot of space (especially when asset_correlation > 0) and the gain in terms of performance is not so evident as we will end up in transfering more data than needed (and performing big matrix multiplication). We have just saved a query which does not seem so expensive. I think we need a smarter solution here. As this change is not related to this pull request, could you roll the code back to the previous implementation?