Skip to content

tracing-subscriber's Directive parsing adds 600us to startup time #3174

Closed
@dpc

Description

@dpc

Bug Report

I was debugging/optimizing startup time of a cli tool I'm working on, and I've noticed
that:

EnvFilter::builder().with_regex(false).parse("debug")

takes around 600us on my machine. Yes, I'm using --release. It seems to me that lazy-compiling the regex used to parse the directives is where the time is spent, because changing to .parse("") is almost instant, and adding a lot of other directives does not seem to change much either.

600us is not all that much, but when we're talking about "blazingly fast" it kind of adds up (another part that I'm looking at is clap, bringing the minimum startup time of my CLI to 1.5ms area in debug builds, and 800us in release builds).

Version

tracing v0.1.41

tracing-subscriber v0.3.19

Platform

Linux ren 6.12.0-rc6 #1-NixOS SMP PREEMPT_DYNAMIC Tue Jan  1 00:00:00 UTC 1980 x86_64 GNU/Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions