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

Memory utilization in complex arithmetic expressions #10278

Closed
ViralBShah opened this issue Feb 22, 2015 · 5 comments
Closed

Memory utilization in complex arithmetic expressions #10278

ViralBShah opened this issue Feb 22, 2015 · 5 comments

Comments

@ViralBShah
Copy link
Member

The memory usage balloons once expression involving complex arithmetic becomes big:

julia> g(a0,a1,a2,a3,a4,x) = for i=1:10^6; f = a0 + a1*x +a2*x^2 + a3*x^3; end
g (generic function with 3 methods)

julia> @time g(1.0,1.0,1.0,1.0,1.0,1+im)
elapsed time: 0.011524283 seconds (104 bytes allocated)

As soon as I introduce the x^4 term, I get:

julia> g(a0,a1,a2,a3,a4,x) = for i=1:10^6; f = a0 + a1*x +a2*x^2 + a3*x^3 + a4*x^4; end
g (generic function with 3 methods)

julia> @time g(1.0,1.0,1.0,1.0,1.0,1+im)
elapsed time: 0.081671568 seconds (129 MB allocated, 10.74% gc time in 6 pauses with 0 full sweep)
@ViralBShah
Copy link
Member Author

@timholy
Copy link
Sponsor Member

timholy commented Feb 22, 2015

I'm having trouble finding the relevant issues, but this has been reported at least twice before. It has to do with our various limits on optimization, e.g., with tuples longer than 8 or something. Add parentheses and see if it fixes it.

This should be evaluated by Horner's method anyway, which will automatically add the parentheses and be much faster.

@ViralBShah
Copy link
Member Author

Yes, I tried looking and couldn't find the relevant issue too.

@simonster
Copy link
Member

@JeffBezanson
Copy link
Sponsor Member

Closing as dup.

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

4 participants