Skip to content

Commit

Permalink
inline a bit to remove an inference trigger
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisRackauckas committed Aug 9, 2021
1 parent 2c18185 commit 08ae3a7
Show file tree
Hide file tree
Showing 3 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 = "DataStructures"
uuid = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
version = "0.18.9"
version = "0.18.10"


[deps]
Expand Down
4 changes: 2 additions & 2 deletions src/heaps/arrays_as_heaps.jl
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function percolate_up!(xs::AbstractArray, i::Integer, x=xs[i], o::Ordering=Forwa
xs[i] = x
end

percolate_up!(xs::AbstractArray, i::Integer, o::Ordering) = percolate_up!(xs, i, xs[i], o)
@inline percolate_up!(xs::AbstractArray, i::Integer, o::Ordering) = percolate_up!(xs, i, xs[i], o)

"""
heappop!(v, [ord])
Expand All @@ -68,7 +68,7 @@ end
Given a binary heap-ordered array, push a new element `x`, preserving the heap property.
For efficiency, this function does not check that the array is indeed heap-ordered.
"""
function heappush!(xs::AbstractArray, x, o::Ordering=Forward)
@inline function heappush!(xs::AbstractArray, x, o::Ordering=Forward)
push!(xs, x)
percolate_up!(xs, length(xs), o)
return xs
Expand Down
2 changes: 1 addition & 1 deletion src/heaps/binary_heap.jl
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ Base.isempty(h::BinaryHeap) = isempty(h.valtree)
Adds the `value` element to the heap `h`.
"""
function Base.push!(h::BinaryHeap, v)
@inline function Base.push!(h::BinaryHeap, v)
heappush!(h.valtree, v, h.ordering)
return h
end
Expand Down

0 comments on commit 08ae3a7

Please sign in to comment.