Skip to content

Commit b224766

Browse files
Remove invalidating ! overloads
Running things downstream, life seems to go on without them just fine. Found in SciML/DifferentialEquations.jl#786 and #77, these methods contribute to a ton of recompilation. Methods that cause lots of compilation but aren't used? Bye bye. Users of Static.jl can just manually handle `!`. It's safe because it just throws an error otherwise. We can put it in an FAQ if it's that much of an issue. But this is definitely not worth causing seconds of JIT lag downstream.
1 parent c75a720 commit b224766

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

src/Static.jl

+3-2
Original file line numberDiff line numberDiff line change
@@ -423,8 +423,9 @@ Base.xor(::StaticInteger{X}, ::StaticInteger{Y}) where {X, Y} = static(xor(X, Y)
423423
Base.xor(::StaticInteger{X}, y::Union{Integer, Missing}) where {X} = xor(X, y)
424424
Base.xor(x::Union{Integer, Missing}, ::StaticInteger{Y}) where {Y} = xor(x, Y)
425425

426-
Base.:(!)(::True) = False()
427-
Base.:(!)(::False) = True()
426+
# These are heavily invalidating, leading to major compile time increases downstream
427+
#Base.:(!)(::True) = False()
428+
#Base.:(!)(::False) = True()
428429

429430
Base.all(::Tuple{Vararg{True}}) = true
430431
Base.all(::Tuple{Vararg{Union{True, False}}}) = false

test/runtests.jl

-2
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,6 @@ end
117117

118118
@test @inferred(~t) === f
119119
@test @inferred(~f) === t
120-
@test @inferred(!t) === f
121-
@test @inferred(!f) === t
122120
@test @inferred(+t) === StaticInt(1)
123121
@test @inferred(+f) === StaticInt(0)
124122
@test @inferred(-t) === StaticInt(-1)

0 commit comments

Comments
 (0)