Skip to content

Commit 87c74d2

Browse files
committed
Always use run-length encoding of types when generating code
1 parent 543cd3c commit 87c74d2

File tree

1 file changed

+17
-21
lines changed

1 file changed

+17
-21
lines changed

src/utils.jl

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -44,29 +44,25 @@ function eachcolumn end
4444

4545
@inline function eachcolumn(f::Base.Callable, sch::Schema{names, types}, row, args...) where {names, types}
4646
if @generated
47-
if length(names) < 100
48-
b = Expr(:block, Any[:(f(getproperty(row, $(Meta.QuoteNode(names[i]))), $i, $(Meta.QuoteNode(names[i])), args...)) for i = 1:length(names)]...)
49-
else
50-
rle = runlength(types)
51-
if length(rle) < 100
52-
block = Expr(:block)
53-
i = 1
54-
for (T, len) in rle
55-
push!(block.args, quote
56-
for j = 0:$(len-1)
57-
f(getproperty(row, $T, $i + j, names[$i + j]), $i + j, names[$i + j], args...)
58-
end
59-
end)
60-
i += len
61-
end
62-
b = block
63-
else
64-
b = quote
65-
for (i, nm) in enumerate(names)
66-
f(getproperty(row, fieldtype(types, i), i, nm), i, nm, args...)
47+
rle = runlength(types)
48+
if length(rle) < 100
49+
block = Expr(:block)
50+
i = 1
51+
for (T, len) in rle
52+
push!(block.args, quote
53+
for j = 0:$(len-1)
54+
f(getproperty(row, $T, $i + j, names[$i + j]), $i + j, names[$i + j], args...)
6755
end
68-
return
56+
end)
57+
i += len
58+
end
59+
b = block
60+
else
61+
b = quote
62+
for (i, nm) in enumerate(names)
63+
f(getproperty(row, fieldtype(types, i), i, nm), i, nm, args...)
6964
end
65+
return
7066
end
7167
end
7268
# println(b)

0 commit comments

Comments
 (0)