> > We currently allocate an uninitialized array and then call the bzero > function to fill it with zeros – this takes a long time for large arrays. > We should instead mmap /dev/zero since that allows the kernel to lazily > allocate pages. I suspect this is what NumPy is doing, which in this > particular benchmark is an increasingly large benefit since huge chunks of > this matrix remain completely zeroed out and can all share a single actual > memory page. There's a very old (closed) issue about this that I've > reopened: #130 <https://github.com/JuliaLang/julia/issues/130>. >
Thanks for looking into this. > Also: I don't think this matters much but in the Julia version, the line > > ham[bra+1,bra+1] = diag_term > > > is outside the `for s in 0:N-2` loop whereas in the Python version, the > corresponding line is inside the loop. That favors the Julia version, > however. > Yep, that was my mistake, thanks (strange I thought I had compared the outputs and they were the same, oh well...).