Hello colleague, i guess we cannot reach a conclusion, but
1. i couldn't see the difference between scalars and matrices of 1x1 in your example. And btw: mysum simply does not make sense; in any case i'd expect a sum operator within the language (which is pretty efficient in Matlab) 2. Citing the behaviour of the 'old' matlab compiler (we're talking here about the differences between matlab v4 and v5 ~ 1999) and try to presume what the current JIT (>R2011a) does is far fetched. On some opportunities i had contact with Matlab developers and always got the picture that they are smart people and aware what's happening around them. For sure they look at developments like julia and try to find out what this could bring to their own domain. Maybe we see a LLVM based Matlab in the future. 3. For using a smart approach to access memory (and at the end of the day everything -not optimized- is a memory access, so there is no difference between scalar and 1x1 matrix) i recommend the Travis.E.Oliphant text "Multidimensional Iterators in Numpy" (my exemplar is from the Beautiful SW book, but this is published elsewhere also) or anything Kuchling wrote about the python dict implementation. 4. (to get this clear) I'm not advocating the use of Matlab over julia. I like julia, i'd like to see this as successful project (and btw: at the moment i'm advocating the use of julia to a Matlab community...) and if i can help, i spend my time on this. But to me this 'Matlab does it wrong' or sometimes 'python does it wrong' mindset, that sometimes shows up in dicussions here, should be justified.