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

local variables in a let block aren't optimized? #16507

Closed
colinfang opened this issue May 22, 2016 · 1 comment
Closed

local variables in a let block aren't optimized? #16507

colinfang opened this issue May 22, 2016 · 1 comment

Comments

@colinfang
Copy link
Contributor

x = [
    1 2 3 4 5 6;
    2 3 4 5 6 7;
]
const y = x

let
    local a = x
    @time for i in 1:10^4 reshape(a, 12) end
end
0.002322 seconds (20.00 k allocations: 781.250 KB)

let
    local a = y
    @time for i in 1:10^4 reshape(a, 12) end
end
0.000344 seconds (10.00 k allocations: 625.000 KB)

It seems the type of a isn't inferred.

@JeffBezanson
Copy link
Sponsor Member

Duplicate of #524 and #8870. This is entirely because of x, and not related to locals or let blocks.

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