Replies: 4 comments 6 replies
-
That’s very interesting. Would you try this once or twice more and see if this can be replicated? I noticed that in the vanilla test function you have a try except block, why is that no longer in the parameterized one? |
Beta Was this translation helpful? Give feedback.
-
I tried to reproduce this, and was getting the opposite result (parameterized running faster than vanilla). I had to make some inference about the code you were using, and I was wondering if you could share a complete example as a single file that demonstrates the behavior, just to be sure that we're working from the same starting point. Thanks! |
Beta Was this translation helpful? Give feedback.
-
example.zip |
Beta Was this translation helpful? Give feedback.
-
To my eyes, it looks like you're not running the same functions. There's a lot more happening in the second function, including casting to object which is going to have a performance penalty. |
Beta Was this translation helpful? Give feedback.
-
Hi, I wrote some benchmarks to see how mojo performs in matmul, following as a guide this: https://docs.modular.com/mojo/notebooks/Matmul.
However, I noticed that my version with parameters is slower than the one without.
The vanilla version benches with 0.2 seconds, while the one with parameters in 1.6 seconds.
The code for the Matrix struct is the same as the one on the docs. This is the vanilla function:
The parameterized version, again very similar to the docs one, is this:
Anyone has some advice on why this is the case? Help would be much appreciated
Beta Was this translation helpful? Give feedback.
All reactions