Skip to content

Commit f584485

Browse files
Merge pull request #10 from ChrisRackauckas/fix-formatting
Apply JuliaFormatter to fix code formatting
2 parents 20b6015 + 66c65ec commit f584485

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ compiled, thus avoiding the invalidation.
1313
The reason for this package essentially comes down to over-aggressive world-splitting optimizations. There's
1414
multiple sources on this optimization:
1515

16-
* https://discourse.julialang.org/t/avoiding-vectors-of-abstract-types/61883/20
17-
* https://discourse.julialang.org/t/how-is-it-that-new-julia-programmers-tend-to-abuse-type-annotations/108465/19
18-
* https://discourse.julialang.org/t/does-julia-create-a-1-5-language-problem/107984/110
19-
* https://discourse.julialang.org/t/static-jl-vs-staticnumbers-jl/87228/21
16+
- https://discourse.julialang.org/t/avoiding-vectors-of-abstract-types/61883/20
17+
- https://discourse.julialang.org/t/how-is-it-that-new-julia-programmers-tend-to-abuse-type-annotations/108465/19
18+
- https://discourse.julialang.org/t/does-julia-create-a-1-5-language-problem/107984/110
19+
- https://discourse.julialang.org/t/static-jl-vs-staticnumbers-jl/87228/21
2020

2121
Basically what happens is that Julia's base image specializes on all of the dispatches it sees in the
2222
world that it builds. So for example, in Julia's Base image, you see that `<(x,y)` always returns a Bool.
@@ -28,7 +28,7 @@ However, enter a library like Symbolics.jl which adds a method `<(x::Num, y)::Nu
2828
represented symbolically rather than eagerly evaluated into a Bool. This breaks the world-splitting
2929
assumptions and thus every single code that assumed `<` would output a Bool has to be recompiled.
3030
However, you can see that it's not only Symbolics.jl that does this, but Static.jl, TaylorModels.jl,
31-
tracers defined in JuMP, ..., there's a huge list of libraries that can trigger this invalidation.
31+
tracers defined in JuMP, ..., there's a huge list of libraries that can trigger this invalidation.
3232

3333
**The issue isn't that these packages are abnormal, it's that Julia's Base image is really abnormal!**
3434
**It's a world with effectively no standard Julia code and no standard Julia package**
@@ -72,9 +72,9 @@ But whatever the matter is, it's very clear that `@recompile_invalidations` is s
7272
too high of a level in those scenarios. What we really want is to simply trigger the invalidations
7373
we know we will have in Pkg, the REPL, etc., force the construction of a new image, and keep that
7474
around for the future. And since we know "most" (according to JuliaHub statistics, around 1300 out of
75-
6000 for Static.jl alone) packages will hit these same invalidators, we might as well put it as the
76-
very bottom of the dependency chain so that this only happens once, and if this package never changes
77-
(or almost never changes), this precompilation only happens the first time you install Julia packages.
75+
6000 for Static.jl alone) packages will hit these same invalidators, we might as well put it as the
76+
very bottom of the dependency chain so that this only happens once, and if this package never changes
77+
(or almost never changes), this precompilation only happens the first time you install Julia packages.
7878
All subsequent updates can then reuse the world that comes after this invalidation fix.
7979

8080
That of course leads directly to CommonWorldInvalidations.jl.
@@ -86,5 +86,5 @@ That is another possible solution. That solution requires convincing everyone th
8686
in cases where these packages aren't used. Of course I throw out 10% as a number I haven't actually measured.
8787
The point is, you'd have to go measure a ton of things and convince a ton of people on each method
8888
despecialization, which may take a lot of time and effort. We would like to see this change happen in Base,
89-
but until that happens, CommonWorldInvalidations.jl effectively renders this a non-issue and we can
89+
but until that happens, CommonWorldInvalidations.jl effectively renders this a non-issue and we can
9090
move on with our lives with this simple little hack in place.

src/CommonWorldInvalidations.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,9 @@ Base.eachindex(::Base.IndexLinear, ::VDespec2) = VDespec3()
9999
Base.eachindex(::Base.IndexLinear, ::VDespec3) = VDespec4()
100100
Base.eachindex(::Base.IndexLinear, ::VDespec4) = VDespec1()
101101

102-
Base.convert(::Type{T}, ::Despec1) where T<:Real = one(T)
103-
Base.convert(::Type{T}, ::Despec2) where T<:Real = one(T)
104-
Base.convert(::Type{T}, ::Despec3) where T<:Real = one(T)
105-
Base.convert(::Type{T}, ::Despec4) where T<:Real = one(T)
102+
Base.convert(::Type{T}, ::Despec1) where {T <: Real} = one(T)
103+
Base.convert(::Type{T}, ::Despec2) where {T <: Real} = one(T)
104+
Base.convert(::Type{T}, ::Despec3) where {T <: Real} = one(T)
105+
Base.convert(::Type{T}, ::Despec4) where {T <: Real} = one(T)
106106

107-
end
107+
end

test/runtests.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# The only test is that the package precompiles and loads!
2-
using CommonWorldInvalidations
2+
using CommonWorldInvalidations

0 commit comments

Comments
 (0)