Skip to content

Commit b805ebd

Browse files
authored
Add some commented-out code for profiling (#292)
1 parent 132bd50 commit b805ebd

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/interpret.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,9 @@ function check_isdefined(frame, @nospecialize(node))
411411
error("unrecognized isdefined node ", node)
412412
end
413413

414+
# For "profiling" where JuliaIntepreter spends its time. See the commented-out block
415+
# in `step_expr!`
416+
const _location = Dict{Tuple{Method,Int},Int}()
414417

415418
function step_expr!(@nospecialize(recurse), frame, @nospecialize(node), istoplevel::Bool)
416419
pc, code, data = frame.pc, frame.framecode, frame.framedata
@@ -420,8 +423,12 @@ function step_expr!(@nospecialize(recurse), frame, @nospecialize(node), istoplev
420423
end
421424
@assert is_leaf(frame)
422425
local rhs
426+
# For debugging:
423427
# show_stackloc(frame)
424428
# @show node
429+
# For profiling:
430+
# location_key = (scopeof(frame), pc)
431+
# _location[location_key] = get(_location, location_key, 0) + 1
425432
try
426433
if isa(node, Expr)
427434
if node.head == :(=)

0 commit comments

Comments
 (0)