• Andrew Thompson's avatar
    In code generated by the parse_transform skip unloggable messages fast · a454d1f2
    Andrew Thompson authored
    Originally an idea that Dizzy forwarded to me from Tony Rogvall.
    Basicially all the work lager does gathering metadata and stuff is
    wrapped in a case statement that fails-fast if the message is definitely
    not going to be logged; the severity isn't currently being consumed and
    there's no traces installed.
    
    In my simple test, logging 1 million debug messages, when the debug
    level is not being consumed, goes from taking 2.99 seconds to 1.21
    seconds with this change.
    
    Also, lager pre 1.0 actually had something similar to this, but it was
    removed during a refactor and never re-added.
    a454d1f2
lager.erl 12.3 KB