You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
functionparse(::Type{T}, c::Char, base::Integer=36) where T<:Integer
a::Int= (base <=36?10:36)
2<= base <=62||throw(ArgumentError("invalid base: base must be 2 ≤ base ≤ 62, got $base"))
d ='0'<= c <='9'? c-'0':
'A'<= c <='Z'? c-'A'+10:
'a'<= c <='z'? c-'a'+a :throw(ArgumentError("invalid digit: $(repr(c))"))
d < base ||throw(ArgumentError("invalid base $base digit $(repr(c))"))
convert(T, d)
end
to:
functionparse2(::Type{T}, c::Char, base::Integer=36) where T<:Integer
a::Int= (base <=36?10:36)
2<= base <=62||throw_invalid_base(base)
d ='0'<= c <='9'? c-'0':'A'<= c <='Z'? c-'A'+10:'a'<= c <='z'? c-'a'+a :throw_invalid_digit(c)
d < base ||throw_invalid_base_digit(base, c)
convert(T, d)
end@noinlinethrow_invalid_base(base) =throw(ArgumentError("invalid base: base must be 2 ≤ base ≤ 62, got $base"))
@noinlinethrow_invalid_digit(c) =throw(ArgumentError("invalid digit: $(repr(c))"))
@noinlinethrow_invalid_base_digit(base, c) =throw(ArgumentError("invalid base $base digit $(repr(c))"))
Is it worth to go through these type of functions and manually outline the error throwing, or is the plan to deal with all of that in another way which does not require manually moving them out?
The text was updated successfully, but these errors were encountered:
There are places in Base where manually outlining error throwing can give significant (relative) speedups. For example, changing
julia/base/parse.jl
Lines 7 to 15 in bdd0e99
has a measurable impact:
Is it worth to go through these type of functions and manually outline the error throwing, or is the plan to deal with all of that in another way which does not require manually moving them out?
The text was updated successfully, but these errors were encountered: