You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am getting "[Info]" printed during compilation, with message "non-literal range". I assume that it is generated by cfor.
How to interpret that message? Does it have performance implications?
Note, myRange is passed as an argument to the function that is using cfor.
The text was updated successfully, but these errors were encountered:
I guess the reason is that non-literal ranges (so ranges, defined outside of the cfor context) cannot be effectively rewritten in a simple while loop. So two examples:
// range is within macro context
cfor(0 until 100 step 5) { i => ???}
// so we expand it into this loop
var i = 0
while (i < 100) {
???
i += 5
}
// here the range itself is outside of the cfor macro context, so it cannot know the shape of the range
val range = 0 until 100 step 5
cfor(range) { i => ???}
// so we expand it into a foreach over range, which is also a nice and fast method to use
range.foreach { i => ???}
I guess I need to clarify this warning a bit:
add benchmarks on literal and non-literal ranges (I bet they will be almost the same)
maybe expand non-literal ranges into another shape of while loop?
more clear warning message in this macro (if my attempt on non-literal expansion fails)
For a line of code:
cfor(myRange) { i =>
I am getting "[Info]" printed during compilation, with message "non-literal range". I assume that it is generated by
cfor
.How to interpret that message? Does it have performance implications?
Note,
myRange
is passed as an argument to the function that is usingcfor
.The text was updated successfully, but these errors were encountered: