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

fast partition #108

Merged
merged 2 commits into from
Jun 14, 2023
Merged

fast partition #108

merged 2 commits into from
Jun 14, 2023

Conversation

pepijndevos
Copy link
Collaborator

Implements suggestions, fixing #39

Current master:
#39 (comment)

On this branch, which is similar to SlidingWindow with support for arbitrary step sizes:

julia> @btime g(1:100000)
  38.671 μs (2 allocations: 144 bytes)
(4999850001, 4999949999, 5000049997)

julia> @btime g2(1:100000)
  36.638 μs (1 allocation: 80 bytes)
(4999850001, 4999949999, 5000049997)

@pepijndevos pepijndevos self-assigned this Jun 14, 2023
@pepijndevos pepijndevos linked an issue Jun 14, 2023 that may be closed by this pull request
@@ -265,14 +265,13 @@ end
# partition(count(1), 2, 1) = (1,2), (2,3), (3,4) ...
# partition(count(1), 2, 3) = (1,2), (4,5), (7,8) ...

struct Partition{I, N}
struct Partition{I, N, K}
Copy link
Member

Choose a reason for hiding this comment

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

technically this can be breaking if someone was doing something like
dispatching on this as a type parameter of another type.

But I double anyone is so i think it's fine

@pepijndevos pepijndevos merged commit 388923f into master Jun 14, 2023
6 checks passed
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.

partition function type stability for constant arguments
2 participants