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

performance of Ref #11531

Closed
StephenVavasis opened this issue Jun 2, 2015 · 3 comments
Closed

performance of Ref #11531

StephenVavasis opened this issue Jun 2, 2015 · 3 comments
Labels
performance Must go faster potential benchmark Could make a good benchmark in BaseBenchmarks

Comments

@StephenVavasis
Copy link
Contributor

I have pointed this out in a discussion of my pull-request on DataStructures.jl, and I also submitted a related documentation issue, but maybe it should be a Julia issue too. For the function

function testref1(m)
    a = [3.0, 4.0, 5.0]
    sm = 0.0
    for i = 1 : m
        q = Ref(a,1)
        sm += q[]
    end
end

I get the following timing result:

julia> @time testref.testref1(100000000)
   1.012 seconds      (100 M allocations: 3052 MB, 16.17% gc time)

Notice the huge memory allocation. The reason is that the object q is allocated on the heap rather than the stack. This behavior suggests that Ref(array,index) should not be used in an inner loop of a high-performance code.

@jakebolewski jakebolewski added the performance Must go faster label Jun 2, 2015
@simonster
Copy link
Member

#8134 should help with this.

@yuyichao
Copy link
Contributor

The case above is handled by the alloc_elim_pass! now.

@tkelman tkelman added the potential benchmark Could make a good benchmark in BaseBenchmarks label Jul 12, 2016
@tkelman
Copy link
Contributor

tkelman commented Jul 12, 2016

is there a perf test for this to catch regressions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Must go faster potential benchmark Could make a good benchmark in BaseBenchmarks
Projects
None yet
Development

No branches or pull requests

5 participants