Skip to content

Commit 53daa57

Browse files
committed
Use @recompile_invalidations to heal Base/Core.Compiler invalidations
This increases the pre-compile time to ~29s on my machine. Fixes significant compilation lag for simple cases like: ``` julia> using Diffractor julia> Int64 Int64 ```
1 parent b23337a commit 53daa57

File tree

3 files changed

+31
-27
lines changed

3 files changed

+31
-27
lines changed

Manifest.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
julia_version = "1.10.0-DEV"
44
manifest_format = "2.0"
5-
project_hash = "dd9f7fdb915ecd02d7d92d5adfe6109efe7a527e"
5+
project_hash = "873ecb13bfc6ab364c1458b076d28239c61c249e"
66

77
[[deps.AbstractTrees]]
88
git-tree-sha1 = "faa260e4cb5aba097a73fab382dd4b5819d8ec8c"
@@ -61,7 +61,7 @@ weakdeps = ["Dates", "LinearAlgebra"]
6161
[[deps.CompilerSupportLibraries_jll]]
6262
deps = ["Artifacts", "Libdl"]
6363
uuid = "e66e0078-7015-5450-92f7-15fbd957f2ae"
64-
version = "1.0.2+0"
64+
version = "1.0.5+0"
6565

6666
[[deps.Cthulhu]]
6767
deps = ["CodeTracking", "FoldingTrees", "InteractiveUtils", "JuliaSyntax", "PrecompileTools", "Preferences", "REPL", "TypedSyntax", "UUIDs", "Unicode", "WidthLimitedIO"]
@@ -192,9 +192,9 @@ version = "1.6.0"
192192

193193
[[deps.PrecompileTools]]
194194
deps = ["Preferences"]
195-
git-tree-sha1 = "259e206946c293698122f63e2b513a7c99a244e8"
195+
git-tree-sha1 = "9673d39decc5feece56ef3940e5dafba15ba0f81"
196196
uuid = "aea7be01-6a6a-4083-8856-8a6e6704d82a"
197-
version = "1.1.1"
197+
version = "1.1.2"
198198

199199
[[deps.Preferences]]
200200
deps = ["TOML"]

Project.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Combinatorics = "861a8166-3701-5b0c-9a16-15d98fcdc6aa"
1010
Cthulhu = "f68482b8-f384-11e8-15f7-abe071a5a75f"
1111
InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
1212
OffsetArrays = "6fe1bfb0-de20-5000-8ca7-80f57d26f881"
13+
PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a"
1314
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
1415
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
1516
StructArrays = "09ab397b-f2b6-538f-b94a-2f83cf4a842a"

src/Diffractor.jl

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,45 @@
11
module Diffractor
22

33
using StructArrays
4+
using PrecompileTools
45

56
export ∂⃖, gradient
67

78
const CC = Core.Compiler
89

910
const GENERATORS = Expr[]
1011

11-
include("runtime.jl")
12-
include("interface.jl")
13-
include("utils.jl")
14-
include("tangent.jl")
15-
include("jet.jl")
12+
@recompile_invalidations begin
13+
include("runtime.jl")
14+
include("interface.jl")
15+
include("utils.jl")
16+
include("tangent.jl")
17+
include("jet.jl")
1618

17-
include("stage1/generated.jl")
18-
include("stage1/forward.jl")
19-
include("stage1/recurse_fwd.jl")
20-
include("stage1/mixed.jl")
21-
include("stage1/broadcast.jl")
19+
include("stage1/generated.jl")
20+
include("stage1/forward.jl")
21+
include("stage1/recurse_fwd.jl")
22+
include("stage1/mixed.jl")
23+
include("stage1/broadcast.jl")
2224

23-
include("stage2/interpreter.jl")
24-
include("stage2/lattice.jl")
25-
include("stage2/abstractinterpret.jl")
26-
include("stage2/tfuncs.jl")
27-
include("stage2/forward.jl")
25+
include("stage2/interpreter.jl")
26+
include("stage2/lattice.jl")
27+
include("stage2/abstractinterpret.jl")
28+
include("stage2/tfuncs.jl")
29+
include("stage2/forward.jl")
2830

29-
include("codegen/forward.jl")
30-
include("analysis/forward.jl")
31-
include("codegen/forward_demand.jl")
32-
include("codegen/reverse.jl")
31+
include("codegen/forward.jl")
32+
include("analysis/forward.jl")
33+
include("codegen/forward_demand.jl")
34+
include("codegen/reverse.jl")
3335

34-
include("extra_rules.jl")
36+
include("extra_rules.jl")
3537

36-
include("higher_fwd_rules.jl")
38+
include("higher_fwd_rules.jl")
3739

38-
include("debugutils.jl")
40+
include("debugutils.jl")
3941

40-
include("stage1/termination.jl")
42+
include("stage1/termination.jl")
43+
end
4144

4245
end

0 commit comments

Comments
 (0)