Skip to content

Commit

Permalink
Revert "work around a splatting penalty in twiceprecision (JuliaLang#…
Browse files Browse the repository at this point in the history
…29060)" (JuliaLang#36728)

But keep the test. This workaround is no longer required, because the
compiler can now understand this pattern.

This reverts commit 88d536a.
  • Loading branch information
Keno authored and simeonschaub committed Aug 11, 2020
1 parent b062b73 commit b933201
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions base/twiceprecision.jl
Original file line number Diff line number Diff line change
Expand Up @@ -335,14 +335,11 @@ const F_or_FF = Union{AbstractFloat, Tuple{AbstractFloat,AbstractFloat}}
asF64(x::AbstractFloat) = Float64(x)
asF64(x::Tuple{AbstractFloat,AbstractFloat}) = Float64(x[1]) + Float64(x[2])

# Defined to prevent splatting in the function below which here has a performance impact
_TP(x) = TwicePrecision{Float64}(x)
_TP(x::Tuple{Any, Any}) = TwicePrecision{Float64}(x[1], x[2])
function steprangelen_hp(::Type{Float64}, ref::F_or_FF,
step::F_or_FF, nb::Integer,
len::Integer, offset::Integer)
StepRangeLen(_TP(ref),
twiceprecision(_TP(step), nb), Int(len), offset)
StepRangeLen(TwicePrecision{Float64}(ref...),
twiceprecision(TwicePrecision{Float64}(step...), nb), Int(len), offset)
end

function steprangelen_hp(::Type{T}, ref::F_or_FF,
Expand Down

0 comments on commit b933201

Please sign in to comment.