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

maximum! allocates #28928

Closed
cossio opened this issue Aug 28, 2018 · 3 comments
Closed

maximum! allocates #28928

cossio opened this issue Aug 28, 2018 · 3 comments

Comments

@cossio
Copy link
Contributor

cossio commented Aug 28, 2018

X = rand(10,3,4); x= rand(1,3,4);
@btime maximum!($x,$X)
# 452.492 ns (6 allocations: 240 bytes)

See https://discourse.julialang.org/t/maximum-allocates/14191.

mbauman added a commit that referenced this issue Aug 29, 2018
…ty edge-cases

Alleviates #28928 but does not completely remove allocations due to the allocation of the view that gets passed to `map!`.
mbauman added a commit that referenced this issue Aug 29, 2018
…ty edge-cases

Alleviates #28928 but does not completely remove allocations due to the allocation of the view that gets passed to `map!`.
mbauman added a commit that referenced this issue Sep 12, 2018
…ty edge-cases

Alleviates #28928 but does not completely remove allocations due to the allocation of the view that gets passed to `map!`.
mbauman added a commit that referenced this issue Dec 1, 2018
* Detangle Slice between whole dimensions and axes

We use axes in many downstream computations that may not re-index directly into the original array, so we add a second type parameter to `Slice` that is turned on when converting `:` in indexing expressions -- and really only `SubArray` cares about.

* Reduce allocations for in-place reductions and fix mixed-dimensionality edge-cases

Alleviates #28928 but does not completely remove allocations due to the allocation of the view that gets passed to `map!`.

* Introduce a whole new IdentityUnitRange

that we will encourage offset array implementations to use instead of Base.Slice

* Test that maximum! allocates less
@cossio
Copy link
Contributor Author

cossio commented Dec 10, 2018

@mbauman Your recent commits are beyond my understanding, so I'm not sure if they fixed the allocations? If so please close this issue.

@mbauman
Copy link
Member

mbauman commented Dec 10, 2018

No, unfortunately I just helped the issue a little bit. As I mentioned in the commit message itself:

Alleviates #28928 but does not completely remove allocations due to the allocation of the view that gets passed to map!.

Your example is down to just one allocation (for that view). You're on a faster machine than me — my previous was ~670ns.

julia> X = rand(10,3,4); x= rand(1,3,4);

julia> @btime maximum!($x,$X)
  546.149 ns (1 allocation: 64 bytes)

@KristofferC
Copy link
Member

Don't think this needs to be kept open since it is unlikely that this single allocation is a performance issue.

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

3 participants