Skip to content

Commit e2f0667

Browse files
authored
faster structarray creation (#266)
1 parent 569c70e commit e2f0667

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "StructArrays"
22
uuid = "09ab397b-f2b6-538f-b94a-2f83cf4a842a"
3-
version = "0.6.14"
3+
version = "0.6.15"
44

55
[deps]
66
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"

src/utils.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,8 @@ maybe_convert_elt(::Type{T}, vals::NamedTuple) where T = T<:NamedTuple ? convert
203203
Compute the unique value that `f` takes on each `component ∈ componenents`.
204204
If not all values are equal, return `nothing`. Otherwise, return the unique value.
205205
"""
206-
function findconsistentvalue(f::F, (col, cols...)::Tup) where F
207-
val = f(col)
208-
isconsistent = mapfoldl(isequal(val)f, &, cols; init=true)
206+
function findconsistentvalue(f::F, cols::Tup) where F
207+
val = f(first(cols))
208+
isconsistent = all(map(isequal(val) f, values(cols)))
209209
return ifelse(isconsistent, val, nothing)
210210
end

0 commit comments

Comments
 (0)