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

Declare level type for default_metafmt #37843

Merged
merged 1 commit into from
Oct 9, 2020
Merged

Conversation

omus
Copy link
Member

@omus omus commented Oct 1, 2020

While investigating invenia/Intervals.jl#144 I noticed these invalidations:

 inserting isless(a, b::Intervals.Endpoint{T, Intervals.Direction{:Left}(), B} where B where T) in Intervals at /Users/omus/.julia/dev/Intervals/src/endpoint.jl:155 invalidated:
   mt_backedges: 1: signature Tuple{typeof(isless), Base.CoreLogging.LogLevel, Any} triggered MethodInstance for <(::Base.CoreLogging.LogLevel, ::Any) (2 children)

 inserting isless(a::Intervals.Endpoint{T, Intervals.Direction{:Right}(), B} where B where T, b) in Intervals at /Users/omus/.julia/dev/Intervals/src/endpoint.jl:164 invalidated:
   mt_backedges: 1: signature Tuple{typeof(isless), Any, Base.CoreLogging.LogLevel} triggered MethodInstance for <(::Any, ::Base.CoreLogging.LogLevel) (3 children)
   41 mt_cache

These Any comparisons are created from Logging.default_metafmt which uses @nospecialize on all arguments. Using a type declaration removes these sources of invalidations. The other changes are minor refactoring to make the code clearer.

Makes `@nospecialize` use precisely `LogLevel` instead of `Any`.
@omus omus added logging The logging framework compiler:latency Compiler latency labels Oct 1, 2020
@omus omus merged commit c67d810 into master Oct 9, 2020
@omus omus deleted the cv/log-level-invalidation branch October 9, 2020 01:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler:latency Compiler latency logging The logging framework
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants