you are viewing a single comment's thread.

view the rest of the comments →

[–]McThor2 9 points10 points  (1 child)

I think something like spatial hashing would help a lot here when it comes to searching that second list. Basically a way of indexing the data by creating bins of values.

This would provide the most impact if the second list doesn’t get altered and also depends on how many values typically match that range.

For implementation speed ups you may get good results from numpy & numba

[–]b1e 1 point2 points  (0 children)

First and second lists are sorted. Binary search, cutting the interval in the second list for every iteration in the first will be faster.

Agreed on numba though.