Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

don't display overhead when called from include() #127

Open
mattuntergassmair opened this issue Jan 12, 2020 · 1 comment
Open

don't display overhead when called from include() #127

mattuntergassmair opened this issue Jan 12, 2020 · 1 comment

Comments

@mattuntergassmair
Copy link

mattuntergassmair commented Jan 12, 2020

I'm using ProfileView to find out which parts of my code need to be optimized. Since the function I am looking at needs quite some preparation (defining variables, building structs, etc.) I decided to put everything inside a profile_my_stuff.jl. All works fine but the graph generated by view() shows quite some overhead left and right of my actual code. (caused by Revise.jl and Base.jl), see screenshot. Is there any way to get rid of these parts? I tried using the pruned keyword to get rid of these parts but it didn't work. I realize I could always just define my variables through the script and then run @profview from the REPL, but being able to have everything in a file would be neat.

Code to reproduce (run directly from REPL or via include("profile_my_stuff.jl"):

using ProfileView

function profile_test(n)
    for i = 1:n
        A = randn(100,100,20)
        m = maximum(A)
        Am = mapslices(sum, A; dims=2)
        B = A[:,:,5]
        Bsort = mapslices(sort, B; dims=1)
        b = rand(100)
        C = B.*b
    end
end

@profview profile_test(1)  # run once to trigger compilation (ignore this one)
@profview profile_test(10)

From REPL:
Screenshot from 2020-01-12 12-33-06

Via include("profile_my_stuff.jl"):
Screenshot from 2020-01-12 12-32-41

My attempt using the pruned keyword:

ProfileView.Profile.clear()
ProfileView.@profile profile_test(10)
ProfileView.view(;pruned=[("include", "Base.jl"), ("run_backend", "Revise.jl")])
@mattuntergassmair
Copy link
Author

Maybe related to #121

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

No branches or pull requests

1 participant