Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Working further on #756, I came up with a faster way to allocate an event list from a list of counts.
Here I compare the performance of the two methods used now (using an iterator) and before #756 (using a list) with two new methods. One using simple numpy array, preallocated, and the other using Numba to further cut on loop execution speed.
So far, the simple numpy implementation seems faster, and comparable to the iterator solution. But the big change happens after the first execution:
Here, the numba-compiled version is more than 10 times faster than the numpy-only solution, and almost 20 times faster than the iterator
In general, the performance push with respect to the iterators is maintained for larger arrays and higher numbers of counts. The numpy-only solution can be faster than Numba with large number of counts and fewer bins:
the Numba solution wins (by a lot) for very long light curves with relatively few counts.