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

Merged
merged 1 commit into from
Nov 18, 2024
Merged

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

Copy link
Member

@OlivierDehaene OlivierDehaene left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice

@drbh drbh merged commit fea62e9 into main Nov 18, 2024
10 of 12 checks passed
@drbh drbh deleted the improve-find-segments-function branch November 18, 2024 14:51
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.

2 participants