My julia code is somehow much slower than the matlab code

I mean to start Julia like this:

julia.exe --optimize=3 -t auto --check-bounds=no 

Then, include your file as: include("\path\to\file.jl")

This will turn off bounds checking in the whole code. So, in debugging phase, it’s not recommended to call Julia like this. The other easier option for you now is just to add @inbounds in front of while and keep your workflow as is.

@inbounds while ..
    ...
end

The version of Julia is not so important, it makes a negligible difference.

This is how it looks when you issue @code_llvm main() in the REPL. Notice these <4 x double> in the middle of a lot of emitted code.

Finally my cpu is 4th gen, that’s 10 years old, but yours is 11th gen, so it should be powerful enough to compete with a desktop cpu that age.

2 Likes