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

Iterators.Flatten allocates on iteration #29762

Closed
hessammehr opened this issue Oct 22, 2018 · 0 comments
Closed

Iterators.Flatten allocates on iteration #29762

hessammehr opened this issue Oct 22, 2018 · 0 comments

Comments

@hessammehr
Copy link
Contributor

Apologies if this has been discussed before. I tried looking through issues and discourse to no avail (see relevant discussion here, here, and here). It appears that Iterators.flatten allocates when it's not supposed to.

using BenchmarkTools
x = [[1, 2, 3, 4], [5, 6, 7, 8]]
f = Iterators.flatten(x)
@benchmark iterate($f)
#  memory estimate:  64 bytes
#  allocs estimate:  2
val, state = iterate(f)
@benchmark iterate($f, $state)
#  memory estimate:  64 bytes
#  allocs estimate:  2

I'm not familiar enough with the output of @code_warntype to be able to dig deeper but was wondering if there has been any work/discussion to get this behaviour fixed.

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