Skip to content

Commit

Permalink
faster structarray creation (#266)
Browse files Browse the repository at this point in the history
  • Loading branch information
aplavin authored Mar 13, 2023
1 parent 569c70e commit e2f0667
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "StructArrays"
uuid = "09ab397b-f2b6-538f-b94a-2f83cf4a842a"
version = "0.6.14"
version = "0.6.15"

[deps]
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"
Expand Down
6 changes: 3 additions & 3 deletions src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,8 @@ maybe_convert_elt(::Type{T}, vals::NamedTuple) where T = T<:NamedTuple ? convert
Compute the unique value that `f` takes on each `component ∈ componenents`.
If not all values are equal, return `nothing`. Otherwise, return the unique value.
"""
function findconsistentvalue(f::F, (col, cols...)::Tup) where F
val = f(col)
isconsistent = mapfoldl(isequal(val)f, &, cols; init=true)
function findconsistentvalue(f::F, cols::Tup) where F
val = f(first(cols))
isconsistent = all(map(isequal(val) f, values(cols)))
return ifelse(isconsistent, val, nothing)
end

2 comments on commit e2f0667

@piever
Copy link
Collaborator

@piever piever commented on e2f0667 Mar 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register()

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/79487

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.6.15 -m "<description of version>" e2f0667ecafc8e6d029242289ff68dee1aafa479
git push origin v0.6.15

Please sign in to comment.