Skip to content

Commit 558fbb6

Browse files
authored
Note that the compiler performs loop unrolling (#46001)
This makes the `@generated` example obsolete, though it is still illustrative.
1 parent 7be96ce commit 558fbb6

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

doc/src/manual/metaprogramming.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1353,7 +1353,8 @@ Both these implementations, although different, do essentially the same thing: a
13531353
over the dimensions of the array, collecting the offset in each dimension into the final index.
13541354

13551355
However, all the information we need for the loop is embedded in the type information of the arguments.
1356-
Thus, we can utilize generated functions to move the iteration to compile-time; in compiler parlance,
1356+
This allows the compiler to move the iteration to compile time and eliminate the runtime loops
1357+
altogether. We can utilize generated functions to achieve a simmilar effect; in compiler parlance,
13571358
we use generated functions to manually unroll the loop. The body becomes almost identical, but
13581359
instead of calculating the linear index, we build up an *expression* that calculates the index:
13591360

0 commit comments

Comments
 (0)