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
The most important change is to update the `repo` in `deploydocs`,
which should have happened when I transferred the package.
Also:
- Improve printing a bit
- disable JET and its tutorial for now
Copy file name to clipboardExpand all lines: docs/src/tutorials/snoop_inference.md
+12-13Lines changed: 12 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -38,7 +38,7 @@ end
38
38
39
39
# output
40
40
41
-
FlattenDemo
41
+
Main.var"Main".FlattenDemo
42
42
```
43
43
44
44
The main call, `packintype`, stores the input in a `struct`, and then calls functions that extract the field value and performs arithmetic on the result.
InferenceTimingNode: 0.002712/0.003278 on Core.Compiler.Timings.ROOT() with 1 direct children
58
+
InferenceTimingNode: 0.000010/0.002443 on MethodInstance for Base.Compiler.Timings.ROOT() with 1 direct children
59
59
```
60
60
61
61
!!! tip
@@ -80,7 +80,7 @@ If you do have a lot of invalidations, [`precompile_blockers`](@ref) may be an e
80
80
81
81
Let's start unpacking the output of `@snoop_inference` and see how to get more insight.
82
82
First, notice that the output is an `InferenceTimingNode`: it's the root element of a tree of such nodes, all connected by caller-callee relationships.
83
-
Indeed, this particular node is for `Core.Compiler.Timings.ROOT()`, a "dummy" node that is the root of all such trees.
83
+
Indeed, this particular node is for `Base.Compiler.Timings.ROOT()`, a "dummy" node that is the root of all such trees.
84
84
85
85
You may have noticed that this `ROOT` node prints with two numbers.
86
86
It will be easier to understand their meaning if we first display the whole tree.
@@ -90,14 +90,13 @@ We can do that with the [AbstractTrees](https://github.com/JuliaCollections/Abst
90
90
julia> using AbstractTrees
91
91
92
92
julia> print_tree(tinf, maxdepth=100)
93
-
InferenceTimingNode: 0.002712/0.003278 on Core.Compiler.Timings.ROOT() with 1 direct children
94
-
└─ InferenceTimingNode: 0.000133/0.000566 on FlattenDemo.packintype(::Int64) with 2 direct children
95
-
├─ InferenceTimingNode: 0.000094/0.000094 on FlattenDemo.MyType{Int64}(::Int64) with 0 direct children
96
-
└─ InferenceTimingNode: 0.000089/0.000339 on FlattenDemo.dostuff(::FlattenDemo.MyType{Int64}) with 2 direct children
97
-
├─ InferenceTimingNode: 0.000064/0.000122 on FlattenDemo.extract(::FlattenDemo.MyType{Int64}) with 2 direct children
98
-
│ ├─ InferenceTimingNode: 0.000034/0.000034 on getproperty(::FlattenDemo.MyType{Int64}, ::Symbol) with 0 direct children
99
-
│ └─ InferenceTimingNode: 0.000024/0.000024 on getproperty(::FlattenDemo.MyType{Int64}, x::Symbol) with 0 direct children
100
-
└─ InferenceTimingNode: 0.000127/0.000127 on FlattenDemo.domath(::Int64) with 0 direct children
93
+
InferenceTimingNode: 0.000010/0.002443 on MethodInstance for Base.Compiler.Timings.ROOT() with 1 direct children
94
+
└─ InferenceTimingNode: 0.001744/0.002433 on MethodInstance for Main.var"Main".FlattenDemo.packintype(::Int64) with 2 direct children
95
+
├─ InferenceTimingNode: 0.000067/0.000070 on MethodInstance for MyType{Int64}(::Int64) with 0 direct children
96
+
└─ InferenceTimingNode: 0.000140/0.000415 on MethodInstance for Main.var"Main".FlattenDemo.dostuff(::MyType{Int64}) with 2 direct children
97
+
├─ InferenceTimingNode: 0.000090/0.000124 on MethodInstance for Main.var"Main".FlattenDemo.extract(::MyType{Int64}) with 1 direct children
98
+
│ └─ InferenceTimingNode: 0.000027/0.000027 on MethodInstance for getproperty(::MyType{Int64}, ::Symbol) with 0 direct children
99
+
└─ InferenceTimingNode: 0.000073/0.000073 on MethodInstance for Main.var"Main".FlattenDemo.domath(::Int64) with 0 direct children
101
100
```
102
101
103
102
This tree structure reveals the caller-callee relationships, showing the specific types that were used for each `MethodInstance`.
@@ -112,10 +111,10 @@ You can extract the `MethodInstance` with
112
111
113
112
```jldoctest flatten-demo
114
113
julia> Core.MethodInstance(tinf)
115
-
MethodInstance for Core.Compiler.Timings.ROOT()
114
+
MethodInstance for Base.Compiler.Timings.ROOT()
116
115
117
116
julia> Core.MethodInstance(tinf.children[1])
118
-
MethodInstance for FlattenDemo.packintype(::Int64)
117
+
MethodInstance for Main.var"Main".FlattenDemo.packintype(::Int64)
119
118
```
120
119
121
120
Each node in this tree is accompanied by a pair of numbers.
0 commit comments