What does @unroll
and @unroll(n)
do?
#482
-
What does I see this in the docs, but I'm not sure what to do with it. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 7 replies
-
These are two loop decorators to tell the compiler to unroll a loop (https://en.wikipedia.org/wiki/Loop_unrolling). This doesn't impact the functionality of the loops, but potentially can help for better performance since it opens possibility for further compiler optimizations. The syntax to use them is something like
or
This decorator can be attached to
Otherwise, compilation fails if a loop is decorated with Here is a brief description of these two decorators in Mojo changelog on 2023-07-26. |
Beta Was this translation helpful? Give feedback.
-
this in the docs performs the same loop unrolling functionality as a library function. There are a few differences between using library function of
|
Beta Was this translation helpful? Give feedback.
These are two loop decorators to tell the compiler to unroll a loop (https://en.wikipedia.org/wiki/Loop_unrolling). This doesn't impact the functionality of the loops, but potentially can help for better performance since it opens possibility for further compiler optimizations.
The syntax to use them is something like
or
This decorator can be attached to
while
statement too.Note that currently the compiler can only unroll a loop, when: