unformat14n
MModular
•Created by unformat14n on 6/8/2024 in #questions
Mandelbrot example equivalent python code
I was reading and following the code in the blog post https://www.modular.com/blog/how-mojo-gets-a-35-000x-speedup-over-python-part-1. I was trying to run the snippets provided but they don't compile by themselves because they are not complete. I found the source code in github https://github.com/modularml/mojo/blob/main/examples/mandelbrot.mojo. I ran this and it works with these results on my machine:
Number of physical cores: 8
Vectorized: 14.634963190184047 ms
Parallelized: 4.1496295025728989 ms
Parallel speedup: 3.5268120156534257
I am trying to write the most basic python code to compare. I wrote this:
But that python code takes 7 minutes to run. This is 30285x slower than the vectorized code. Am I doing this right? The page only claimed an 89x but maybe the blog post has not yet been written to explain the vectorized code speed up?4 replies