Skip to content

Commit

Permalink
work around a splatting penalty in twiceprecision
Browse files Browse the repository at this point in the history
  • Loading branch information
KristofferC committed Sep 5, 2018
1 parent 8d99356 commit 998831e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions base/twiceprecision.jl
Original file line number Diff line number Diff line change
Expand Up @@ -332,11 +332,14 @@ 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(TwicePrecision{Float64}(ref...),
twiceprecision(TwicePrecision{Float64}(step...), nb), Int(len), offset)
StepRangeLen(_TP(ref),
twiceprecision(_TP(step), nb), Int(len), offset)
end

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

0 comments on commit 998831e

Please sign in to comment.