Skip to content

Conversation

@mkitti
Copy link
Contributor

@mkitti mkitti commented Apr 14, 2024

With Julia 1.6, a precompile statement is generated:

julia> using SnoopCompile

julia> logfile = joinpath(tempdir(), "anon.log")
"/tmp/anon.log"

julia> @snoopc logfile begin
           map(x->x^2, [1,2,3])
       end
Launching new julia process to run commands...
done.

julia> data = SnoopCompile.read(logfile)
(UInt64[0x00000000003d57dc, 0x00000000003d590b, 0x00000000016f8738], ["Tuple{Type{Base.Generator{I, F} where F where I}, Main.var\"#1#2\", Array{Int64, 1}}", "Tuple{typeof(Base.map), Function, Array{Int64, 1}}", "Tuple{typeof(Base.collect_similar), Array{Int64, 1}, Base.Generator{Array{Int64, 1}, Main.var\"#1#2\"}}"])

julia> read(logfile, String) |> println
4020491	"Tuple{typeof(Base.map), Function, Array{Int64, 1}}"
4020188	"Tuple{Type{Base.Generator{I, F} where F where I}, Main.var"#1#2", Array{Int64, 1}}"
24086328	"Tuple{typeof(Base.collect_similar), Array{Int64, 1}, Base.Generator{Array{Int64, 1}, Main.var"#1#2"}}"


julia> pc = SnoopCompile.parcel(reverse!(data[2]))
Dict{Symbol, Vector{String}} with 1 entry:
  :Base => ["precompile(Tuple{typeof(Base.map), typeof(identity), Array{Int64, 1}})"]

With Julia 1.10, the new precompile statement is not generated:

julia> using SnoopCompile

julia> logfile = joinpath(tempdir(), "anon.log")
"/tmp/anon.log"

julia> @snoopc logfile begin
           map(x->x^2, [1,2,3])
       end
Launching new julia process to run commands...
done.

julia> data = SnoopCompile.read(logfile)
(UInt64[0x00000000003bc942, 0x00000000013bae2e], ["Tuple{Type{Base.Generator{I, F} where F where I}, Main.var\"#1#2\", Array{Int64, 1}}", "Tuple{typeof(Base.collect_similar), Array{Int64, 1}, Base.Generator{Array{Int64, 1}, Main.var\"#1#2\"}}"])

julia> read(logfile, String) |> println
3918146	"Tuple{Type{Base.Generator{I, F} where F where I}, Main.var"#1#2", Array{Int64, 1}}"
20688430	"Tuple{typeof(Base.collect_similar), Array{Int64, 1}, Base.Generator{Array{Int64, 1}, Main.var"#1#2"}}"


julia> pc = SnoopCompile.parcel(reverse!(data[2]))
Dict{Symbol, Vector{String}}()

@codecov
Copy link

codecov bot commented Apr 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 85.34%. Comparing base (622b233) to head (0cfecc4).
Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #380      +/-   ##
==========================================
+ Coverage   78.96%   85.34%   +6.38%     
==========================================
  Files          17       17              
  Lines        2054     2191     +137     
==========================================
+ Hits         1622     1870     +248     
+ Misses        432      321     -111     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@timholy timholy merged commit 91d3685 into JuliaDebug:master Apr 16, 2024
@timholy
Copy link
Member

timholy commented Apr 16, 2024

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants