Skip to content

Commit

Permalink
specialize hastypemax on Bool (#42300)
Browse files Browse the repository at this point in the history
Since `Bool` is not included in `Base.BitIntegerType`, `hastypemax(Bool)` falls back to the slow generic version. This reduces the performance of `digits!` with Boolean target vector (for `base=2`) significantly. Specializing `hastypemax` on `Bool` fixes this performance bug.
  • Loading branch information
ranocha authored Sep 18, 2021
1 parent b8e48e0 commit e50603f
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions base/intfuncs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -882,6 +882,7 @@ end
Return true if and only if the extrema `typemax(T)` and `typemin(T)` are defined.
"""
hastypemax(::Base.BitIntegerType) = true
hastypemax(::Type{Bool}) = true
hastypemax(::Type{T}) where {T} = applicable(typemax, T) && applicable(typemin, T)

"""
Expand Down

2 comments on commit e50603f

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Executing the daily package evaluation, I will reply here when finished:

@nanosoldier runtests(ALL, isdaily = true)

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your package evaluation job has completed - possible new issues were detected. A full report can be found here.

Please sign in to comment.