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

High allocations in Zip() #564

Open
artemsolod opened this issue Sep 23, 2023 · 0 comments
Open

High allocations in Zip() #564

artemsolod opened this issue Sep 23, 2023 · 0 comments

Comments

@artemsolod
Copy link

Zip(x, y) allocates a lot in a simple use case (foo). Zip(x) with a single argument seems ok.
System: julia 1.9.3, Transducers v0.4.78, Ubuntu

julia> using Transducers, BenchmarkTools

julia> foo(vals) = vals |> Zip(Map(identity), Map(identity)) |> collect
foo (generic function with 1 method)

julia> vals = collect(1:10_000);

julia> @btime foo($vals); # Zip(x, y)
  6.014 ms (150060 allocations: 5.22 MiB)

julia> foo1(vals) = vals |> Zip(Map(identity)) |> collect
foo1 (generic function with 1 method)

julia> @btime foo1($vals); # Zip(x)
  205.577 μs (17 allocations: 326.78 KiB)
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