Mojo for-loop performance
https://github.com/sstadick/rust-vs-mojo-loop
While profiling other code, trying to get my perf to match Rust, I noticed that my vanilla for-loop seemed to be one large source of difference. I'm not great with assembly, but looking at what was generated it seemed like Rust was able to skip bound checks when indexing into the arrays since the length of the array was/is given in the range.
Has anyone else ran into this? While this is a toy example, I've run into in more complex scenarios and with real data as well.
The two programs in question, repo has benching script:
While profiling other code, trying to get my perf to match Rust, I noticed that my vanilla for-loop seemed to be one large source of difference. I'm not great with assembly, but looking at what was generated it seemed like Rust was able to skip bound checks when indexing into the arrays since the length of the array was/is given in the range.
Has anyone else ran into this? While this is a toy example, I've run into in more complex scenarios and with real data as well.
The two programs in question, repo has benching script:
GitHub
Contribute to sstadick/rust-vs-mojo-loop development by creating an account on GitHub.
