Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: improve find_segments via numpy diff #2686

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

drbh
Copy link
Collaborator

@drbh drbh commented Oct 24, 2024

This PR updates find_segments to use a numpy array rather than a list. This allow us to a more efficiently find the segments via masking.

when testing the method in isolation this results in a ~3x speedup on 4096 indices

Benchmarking results:
--------------------------------------------------------------------------------
        Size   Original (ms)  Optimized (ms)    Speedup
--------------------------------------------------------------------------------
        4096            0.32            0.08       3.94
        8192            0.59            0.14       4.13
       16384            1.24            0.20       6.06
       32768            2.31            0.32       7.12
       65536            4.57            0.58       7.93

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant