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 performance of collect on size unstable collections. #554

Open
MasonProtter opened this issue May 5, 2023 · 0 comments
Open

Improve performance of collect on size unstable collections. #554

MasonProtter opened this issue May 5, 2023 · 0 comments

Comments

@MasonProtter
Copy link
Member

Okay, so the low hanging fruit of SizeStable collections should be dealt with in #553, but SizeChanging collections also need attention:

julia> let v = randn(10000)
           @btime filter(x -> x < 1000, $v)
           @btime collect(Filter(x -> x < 1000), $v)
       end
  4.767 μs (2 allocations: 78.17 KiB)
  7.820 μs (10 allocations: 326.61 KiB)

Perhaps the most catastrophic offender I've seen is Partiton.

julia> let v = rand(10000), sz = 6
           @btime collect(Iterators.partition($v, $sz))
           @btime collect(Partition($sz), $v)
       end;
  3.197 μs (2 allocations: 65.17 KiB)
  18.825 ms (189965 allocations: 6.52 MiB)
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

No branches or pull requests

1 participant