Skip to content

Conversation

IanButterworth
Copy link
Collaborator

@IanButterworth IanButterworth commented Jul 9, 2025

On top of #36

verbose = :none (default), :internal, :external, :all

i.e.

% julia +nightly -E 'using MethodAnalysis, PkgCacheInspector; info_cachefile("Dates", verbose=:external)'

@IanButterworth IanButterworth marked this pull request as draft July 9, 2025 17:58
Comment on lines 223 to 241
function show_verbose_external_methods(io::IO, info::PkgCacheInfo)
# Separate truly external methods from internal ones
truly_external_methods = []
internal_method_specializations = []

for ci in info.external_methods
if isa(ci, Core.CodeInstance) && isa(ci.def, Core.MethodInstance)
mi = ci.def
if isa(mi.def, Method)
method = mi.def
# Check if this method is truly external (not from package's own modules)
if method.module info.modules
push!(truly_external_methods, (ci, method, mi))
else
push!(internal_method_specializations, (ci, method, mi))
end
end
end
end
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't sure if I just misunderstood what info.external_methods is but it seems some are internal? Note the filtering

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this means the counts are wrong / misleading too, so this should probably be fixed in the info constructor?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It may also include methods that were defined in this module that extend functions owned by other packages.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not entirely sure. If you have a chance to play with this PR and if it's making sense to you I can continue to work on it. Otherwise this is a bit of a Claude expedition that I've not spent time to fully understand.

Totally fair if it's not appealing to spend your time on in this state.

@timholy
Copy link
Owner

timholy commented Jul 25, 2025

Do you think this might be better as a filter rather than a printer? It seems you can do more if you pass back the subset of methods rather than just printing them.

@IanButterworth
Copy link
Collaborator Author

I think there's uses for both. With "verbose" stuff it's kind of useful to just dump things into a text file etc.

Base automatically changed from ib/estimate_size to main July 29, 2025 00:44
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