I have two versions of this reshape function - 
https://gist.github.com/jamii/62b3c3695fba95f3f09b

The produce near-identical ast from code_warntype - 
https://www.diffchecker.com/awnv9zvv

But code_lowered shows that reshape naively boxes tuples whereas reshape2 
does something much more complicated - https://www.diffchecker.com/jb6aurpl

The result is that reshape2 is much faster:

reshape: 0.316513 seconds (2.00 M allocations: 95.036 MB, 5.41% gc time)
reshape2:  0.218963 seconds (41 allocations: 34.001 MB, 0.85% gc time)

What's going on? How can I make reshape avoid boxing?

Reply via email to