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

expm is allocating #578

Closed
nlw0 opened this issue Dec 27, 2018 · 4 comments
Closed

expm is allocating #578

nlw0 opened this issue Dec 27, 2018 · 4 comments
Labels

Comments

@nlw0
Copy link

nlw0 commented Dec 27, 2018

It seems this line from the exp() method

nA = maximum(sum(abs.(A); dims=Val(1))) # marginally more performant than norm(A, 1)

is causing a couple of allocations, what I imagine is not something desirable. Just using opnorm(A,1) prevents it.

I am not sure how to go about making a PR, should I go for a non-allocating version of this, or just move back to opnorm?

@nlw0
Copy link
Author

nlw0 commented Dec 27, 2018

#579

@c42f c42f added the performance runtime performance label Jul 31, 2019
@c42f
Copy link
Member

c42f commented Jul 31, 2019

The underlying problem here seems to be that sum(A; dims=Val(1)) is allocating:

julia> A = @SArray rand(4,4);

julia> @btime sum($A; dims=Val(1))
  28.764 ns (2 allocations: 192 bytes)
1×4 SArray{Tuple{1,4},Float64,2,4} with indices SOneTo(1)×SOneTo(4):
 1.09627  1.93056  1.62516  2.25825

@c42f
Copy link
Member

c42f commented Jul 31, 2019

Ultimately root cause may be a dup of #540 and #541

@mateuszbaran
Copy link
Collaborator

It's fixed on master (most likely a duplicate of #540).

@c42f c42f mentioned this issue Oct 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants