<p dir="auto">I've reported this problem before on discourse but apparently I didn't file an issue, and the fix was not included in 0.5.1.  There is a performance bug in 0.5.0, and also now in 0.5.1, with arrays that have 6 or more subscripts.  The bug is fixed in 0.4.7 and was also fixed in 0.6.0 last time I checked.  Here is a sample.</p>
<div class="highlight highlight-source-julia notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="
julia&gt; @time test_manyway.test2way(100000)
  0.001451 seconds (6 allocations: 288 bytes)
49987.500777183195

julia&gt; @time test_manyway.test4way(100000)
  0.005792 seconds (7 allocations: 432 bytes)
50226.90084188317

julia&gt; @time test_manyway.test6way(100000)
 10.533045 seconds (64.00 M allocations: 1.526 GB, 1.35% gc time)
49979.21341756834"><pre class="notranslate">julia<span class="pl-k">&gt;</span> <span class="pl-c1">@time</span> test_manyway<span class="pl-k">.</span><span class="pl-c1">test2way</span>(<span class="pl-c1">100000</span>)
  <span class="pl-c1">0.001451</span> seconds (<span class="pl-c1">6</span> allocations<span class="pl-k">:</span> <span class="pl-c1">288</span> bytes)
<span class="pl-c1">49987.500777183195</span>

julia<span class="pl-k">&gt;</span> <span class="pl-c1">@time</span> test_manyway<span class="pl-k">.</span><span class="pl-c1">test4way</span>(<span class="pl-c1">100000</span>)
  <span class="pl-c1">0.005792</span> seconds (<span class="pl-c1">7</span> allocations<span class="pl-k">:</span> <span class="pl-c1">432</span> bytes)
<span class="pl-c1">50226.90084188317</span>

julia<span class="pl-k">&gt;</span> <span class="pl-c1">@time</span> test_manyway<span class="pl-k">.</span><span class="pl-c1">test6way</span>(<span class="pl-c1">100000</span>)
 <span class="pl-c1">10.533045</span> seconds (<span class="pl-c1">64.00</span> M allocations<span class="pl-k">:</span> <span class="pl-c1">1.526</span> GB, <span class="pl-c1">1.35</span><span class="pl-k">%</span> gc time)
<span class="pl-c1">49979.21341756834</span></pre></div>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="module test_manyway

function test2way(n)
    a2 = zeros(2,2)
    x = 0.0
    for tr = 1 : n
        for j1 = 1 : 2
            for j2 = 1 : 2
                a2[j1,j2] = rand()
            end
        end
        x += a2[1,1]
    end
    x
end

function test4way(n)
    a4 = zeros(2,2,2,2)
    x = 0.0
    for tr = 1 : n
        for j1 = 1 : 2
            for j2 = 1 : 2
                for j3 = 1 : 2
                    for j4 = 1 : 2
                        a4[j1,j2,j3,j4] = rand()
                    end
                end
            end
        end
        x += a4[1,1,1,1]
    end
    x
end

function test6way(n)
    a6 = zeros(2,2,2,2,2,2)
    x = 0.0
    for tr = 1 : n
        for j1 = 1 : 2
            for j2 = 1 : 2
                for j3 = 1 : 2
                    for j4 = 1 : 2
                        for j5 = 1 : 2
                            for j6 = 1 : 2
                                a6[j1,j2,j3,j4,j5,j6] = rand()
                            end
                        end
                    end
                end
            end
        end
        x += a6[1,1,1,1,1,1]
    end
    x
end


function test7way(n)
    a7 = zeros(2,2,2,2,2,2,2)
    x = 0.0
    for tr = 1 : n
        for j1 = 1 : 2
            for j2 = 1 : 2
                for j3 = 1 : 2
                    for j4 = 1 : 2
                        for j5 = 1 : 2
                            for j6 = 1 : 2
                                for j7 = 1 : 2
                                    a7[j1,j2,j3,j4,j5,j6,j7] = rand()
                                end
                            end
                        end
                    end
                end
            end
        end
        x += a7[1,1,1,1,1,1,1]
    end
    x
end



function test8way(n)
    a8 = zeros(2,2,2,2,2,2,2,2)
    x = 0.0
    for tr = 1 : n
        for j1 = 1 : 2
            for j2 = 1 : 2
                for j3 = 1 : 2
                    for j4 = 1 : 2
                        for j5 = 1 : 2
                            for j6 = 1 : 2
                                for j7 = 1 : 2
                                    for j8 = 1 : 2
                                        a8[j1,j2,j3,j4,j5,j6,j7,j8] = rand()
                                    end
                                end
                            end
                        end
                    end
                end
            end
        end
        x += a8[1,1,1,1,1,1,1,1]
    end
    x
end

function test8wayb(n)
    x = 0.0
    x2 = 0.0
    for tr = 1 : n
        for j1 = 1 : 2
            for j2 = 1 : 2
                for j3 = 1 : 2
                    for j4 = 1 : 2
                        for j5 = 1 : 2
                            for j6 = 1 : 2
                                for j7 = 1 : 2
                                    for j8 = 1 : 2
                                        x2 = rand()
                                    end
                                end
                            end
                        end
                    end
                end
            end
        end
        x += x2
    end
    x
end
end"><pre class="notranslate"><code class="notranslate">module test_manyway

function test2way(n)
    a2 = zeros(2,2)
    x = 0.0
    for tr = 1 : n
        for j1 = 1 : 2
            for j2 = 1 : 2
                a2[j1,j2] = rand()
            end
        end
        x += a2[1,1]
    end
    x
end

function test4way(n)
    a4 = zeros(2,2,2,2)
    x = 0.0
    for tr = 1 : n
        for j1 = 1 : 2
            for j2 = 1 : 2
                for j3 = 1 : 2
                    for j4 = 1 : 2
                        a4[j1,j2,j3,j4] = rand()
                    end
                end
            end
        end
        x += a4[1,1,1,1]
    end
    x
end

function test6way(n)
    a6 = zeros(2,2,2,2,2,2)
    x = 0.0
    for tr = 1 : n
        for j1 = 1 : 2
            for j2 = 1 : 2
                for j3 = 1 : 2
                    for j4 = 1 : 2
                        for j5 = 1 : 2
                            for j6 = 1 : 2
                                a6[j1,j2,j3,j4,j5,j6] = rand()
                            end
                        end
                    end
                end
            end
        end
        x += a6[1,1,1,1,1,1]
    end
    x
end


function test7way(n)
    a7 = zeros(2,2,2,2,2,2,2)
    x = 0.0
    for tr = 1 : n
        for j1 = 1 : 2
            for j2 = 1 : 2
                for j3 = 1 : 2
                    for j4 = 1 : 2
                        for j5 = 1 : 2
                            for j6 = 1 : 2
                                for j7 = 1 : 2
                                    a7[j1,j2,j3,j4,j5,j6,j7] = rand()
                                end
                            end
                        end
                    end
                end
            end
        end
        x += a7[1,1,1,1,1,1,1]
    end
    x
end



function test8way(n)
    a8 = zeros(2,2,2,2,2,2,2,2)
    x = 0.0
    for tr = 1 : n
        for j1 = 1 : 2
            for j2 = 1 : 2
                for j3 = 1 : 2
                    for j4 = 1 : 2
                        for j5 = 1 : 2
                            for j6 = 1 : 2
                                for j7 = 1 : 2
                                    for j8 = 1 : 2
                                        a8[j1,j2,j3,j4,j5,j6,j7,j8] = rand()
                                    end
                                end
                            end
                        end
                    end
                end
            end
        end
        x += a8[1,1,1,1,1,1,1,1]
    end
    x
end

function test8wayb(n)
    x = 0.0
    x2 = 0.0
    for tr = 1 : n
        for j1 = 1 : 2
            for j2 = 1 : 2
                for j3 = 1 : 2
                    for j4 = 1 : 2
                        for j5 = 1 : 2
                            for j6 = 1 : 2
                                for j7 = 1 : 2
                                    for j8 = 1 : 2
                                        x2 = rand()
                                    end
                                end
                            end
                        end
                    end
                end
            end
        end
        x += x2
    end
    x
end
end
</code></pre></div>
<p dir="auto">A few months back, I reported on discourse that arrays with 5 or more subscripts have severe performance problems in 0.5.0.  This has apparently still not been fixed in 0.5.0 (although it is fixed in 0.6.0).  I've noticed on github that several important packages are preparing to drop 0.4 support.  If the consensus of the core Julia developers is to drop 0.4 support before 0.6.0 is released, then please issue a patch for this bug in 0.5.0, because right now 0.5.0 is unusable for me due to my heavy use of 5- and 6-subscript arrays.    Apparently the patch for this bug is quite simple, but I am not able to patch my system image in Windows 10. (The instructions in the docs for patching system images did not work for me).</p>
<p dir="auto">Thanks,<br>
Steve Vavasis</p>