Skip to content

Commit

Permalink
Ensure eachcolumn generated functions get inlined
Browse files Browse the repository at this point in the history
  • Loading branch information
quinnj committed Oct 18, 2018
1 parent b393e97 commit 7f9a1f9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,20 @@ function eachcolumn end
if @generated
rle = runlength(types)
if length(rle) < 100
block = Expr(:block)
block = Expr(:block, Expr(:meta, :inline))
i = 1
for (T, len) in rle
push!(block.args, quote
for j = 0:$(len-1)
f(getproperty(row, $T, $i + j, names[$i + j]), $i + j, names[$i + j], args...)
@inbounds f(getproperty(row, $T, $i + j, names[$i + j]), $i + j, names[$i + j], args...)
end
end)
i += len
end
b = block
else
b = quote
$(Expr(:meta, :inline))
for (i, nm) in enumerate(names)
f(getproperty(row, fieldtype(types, i), i, nm), i, nm, args...)
end
Expand Down

0 comments on commit 7f9a1f9

Please sign in to comment.