From 256f7846676564f3f7e0b49ec9be010b32d586e2 Mon Sep 17 00:00:00 2001 From: Tim Holy Date: Sat, 8 Jul 2017 15:25:16 -0500 Subject: [PATCH] Fix some performance issues due to new InexactError --- base/inference.jl | 2 +- base/int.jl | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/base/inference.jl b/base/inference.jl index 07de93511202e2..2e0acfa5dc4781 100644 --- a/base/inference.jl +++ b/base/inference.jl @@ -29,7 +29,7 @@ struct InferenceParams # reasonable defaults function InferenceParams(world::UInt; inlining::Bool = inlining_enabled(), - inline_cost_threshold::Int = 100, + inline_cost_threshold::Int = 150, inline_nonleaf_penalty::Int = 1000, inline_tupleret_bonus::Int = 400, max_methods::Int = 4, diff --git a/base/int.jl b/base/int.jl index 9edfacff6c6ee8..5d9d1036ca52d3 100644 --- a/base/int.jl +++ b/base/int.jl @@ -29,6 +29,9 @@ const BitIntegerSmall = Union{BitIntegerSmall_types...} const BitSigned64T = Union{Type{Int8}, Type{Int16}, Type{Int32}, Type{Int64}} const BitUnsigned64T = Union{Type{UInt8}, Type{UInt16}, Type{UInt32}, Type{UInt64}} +throw_inexacterror(f::Symbol, ::Type{T}, val) where T = + (@_noinline_meta; throw(InexactError(f, T, val))) + ## integer comparisons ## (<)(x::T, y::T) where {T<:BitSigned} = slt_int(x, y) @@ -401,7 +404,7 @@ function is_top_bit_set(x::BitInteger) end function check_top_bit(x::BitInteger) @_inline_meta - is_top_bit_set(x) && throw(InexactError(:check_top_bit, Integer, x)) + is_top_bit_set(x) && throw_inexacterror(:check_top_bit, typeof(x), x) x end @@ -411,7 +414,7 @@ function checked_trunc_sint{To,From}(::Type{To}, x::From) @_inline_meta y = trunc_int(To, x) back = sext_int(From, y) - x == back || throw(InexactError(:trunc, To, x)) + x == back || throw_inexacterror(:trunc, To, x) y end @@ -419,7 +422,7 @@ function checked_trunc_uint{To,From}(::Type{To}, x::From) @_inline_meta y = trunc_int(To, x) back = zext_int(From, y) - x == back || throw(InexactError(:trunc, To, x)) + x == back || throw_inexacterror(:trunc, To, x) y end