RFC: allow precompile to associate a MethodInstance with a module #31466
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Suppose we have a package that does this:
Unfortunately, the
precompiledoes nothing useful. I dove into this in some detail. It appears that the reason is that nosetindex!methods are defined inMyPkg, and consequently the corresponding bindingbhasb->value == NULL. As a consequence it doesn't get added to the*.jicache file.This is unfortunate, because inferring
setindex!for Dicts is quite expensive. This PR aims to fix that by allowing package authors to writeprecompile(MyPkg, setindex!, (Dict{T,Int}, Int, T))Note the module argument in the first slot. This adds it to a list of MethodInstances that should be associated with
MyPkg.I've verified it doesn't break anything, but it doesn't yet work. I tried the instructions here but gdb complains
Perhaps someone who knows more about this than me can offer some helpful tips.
I am not sure this alone will suffice, but I suspect that perhaps in conjunction with just a few other tweaks (and good ways to measure time spent on inference, see #31444 and this SnoopCompile branch) we could dramatically cut latencies for certain packages. CC @SimonDanisch, who I know is very interested in the topic.