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

+ with many arguments #3206

Closed
vtjnash opened this issue May 26, 2013 · 1 comment
Closed

+ with many arguments #3206

vtjnash opened this issue May 26, 2013 · 1 comment
Assignees
Labels
performance Must go faster

Comments

@vtjnash
Copy link
Sponsor Member

vtjnash commented May 26, 2013

This function allocates large numbers of gc roots:

function laplace2 (del_x::Array{Float64, 3}, x::Array{Float64, 3})

               n1, n2, n3 = size (x)
               for i1 = 1:n1, i2 = 1:n2, i3 = 1:n3
                       del_x[i1,i2,i3] =
                               x[i1,i2,i3] + x[i1,i2,i3] +
                               x[i1,i2,i3] + x[i1,i2,i3] +
                               x[i1,i2,i3] + x[i1,i2,i3]
               end

       end

while this function does not:

function laplace2 (del_x::Array{Float64, 3}, x::Array{Float64, 3})

               n1, n2, n3 = size (x)
               for i1 = 1:n1, i2 = 1:n2, i3 = 1:n3
                       del_x[i1,i2,i3] =
                               x[i1,i2,i3] + x[i1,i2,i3] +
                               x[i1,i2,i3] + x[i1,i2,i3]
               end

       end
@ghost ghost assigned JeffBezanson May 26, 2013
@andrioni
Copy link
Member

Maybe it's because the first one calls the varargs + method, while the second one not?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Must go faster
Projects
None yet
Development

No branches or pull requests

3 participants