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

improve group performance #50

Merged
merged 2 commits into from
Jun 30, 2022
Merged

improve group performance #50

merged 2 commits into from
Jun 30, 2022

Conversation

aplavin
Copy link
Collaborator

@aplavin aplavin commented Apr 30, 2022

create 1-vector instead of creating empty vector and pushing to it

@aplavin
Copy link
Collaborator Author

aplavin commented Apr 30, 2022

Failures on 1.0 seem totally unrelated.

Copy link
Member

@andyferris andyferris left a comment

Choose a reason for hiding this comment

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

Yes, unfortunately the push! route can be a little bit slow (last I checked there should be micro-optimization opportunates for Julia there). Have you got a benchmark for these improvements @aplavin?

I find that injecting the type T is really useful for inferring cases like Union{Missing, X}.

src/group.jl Outdated Show resolved Hide resolved
@aplavin
Copy link
Collaborator Author

aplavin commented Jun 27, 2022

There are minor performance improvements for small groups, and no difference for large groups. Eg:

julia> A = 1:100
1:100

# before
julia> @btime groupview(a -> a % 100, $A);
  8.927 μs (216 allocations: 23.52 KiB)

# after
julia> @btime groupview(a -> a % 100, $A);
  7.812 μs (116 allocations: 15.70 KiB)

Something along these lines #28 would make much more difference, I think.

@andyferris
Copy link
Member

Awesome, that’s still a nice improvement.

@aplavin aplavin merged commit db1924f into JuliaData:main Jun 30, 2022
@aplavin aplavin deleted the patch-1 branch June 30, 2022 21:39
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