You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Due to the fact that the compiler has to monomorphize the function, it's advisable to create a wrapper function that does the .as_ref()/.as_mut()/.into() calls and then calls the inner function. That way the monomorphization pass only has to generate one call per instantiated method.
This can be done by first checking methods for generics and if any are detected call the ComplexityVisitor with a severely reduced threshold. We probably need to noodle around a bit to find the correct number here.
The text was updated successfully, but these errors were encountered:
Good idea, but might be hard to get right: This is only relevant if the function is actually called in several ways. So maybe always triggering this for pub items and if you can prove that a non-pubfn it is called with more than n variants? Do we want to check if this also happens transitively?
In addition to all that I think it might be possible to have rustc optimize this aways, i.e. generate that wrapper function automatically.
Due to the fact that the compiler has to monomorphize the function, it's advisable to create a wrapper function that does the
.as_ref()
/.as_mut()
/.into()
calls and then calls the inner function. That way the monomorphization pass only has to generate one call per instantiated method.This can be done by first checking methods for generics and if any are detected call the ComplexityVisitor with a severely reduced threshold. We probably need to noodle around a bit to find the correct number here.
The text was updated successfully, but these errors were encountered: