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

Improve logql parser allocations. #2927

Merged
merged 2 commits into from
Nov 13, 2020
Merged

Commits on Nov 13, 2020

  1. Improve logql parser allocations.

    Also moving labels parsing into logql package, and I'm not shy to say that promql is faster for this.
    So we're using promql for parser, it's faster because their lexer is more sophisticated than ours.
    
    Result are impressive.
    
    ```
    ❯ benchcmp before.txt after.txt
    benchmark                    old ns/op     new ns/op     delta
    Benchmark_ParseLabels-16     24394         8745          -64.15%
    
    benchmark                    old allocs     new allocs     delta
    Benchmark_ParseLabels-16     156            20             -87.18%
    
    benchmark                    old bytes     new bytes     delta
    Benchmark_ParseLabels-16     24976         2099          -91.60%
    ```
    
    Combined with grafana#2926, I think we should be able to get rid of `util.ToClientLabels`. But that's for another PR.
    
    Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
    cyriltovena committed Nov 13, 2020
    Configuration menu
    Copy the full SHA
    e27a3f1 View commit details
    Browse the repository at this point in the history
  2. Fixes a test.

    Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
    cyriltovena committed Nov 13, 2020
    Configuration menu
    Copy the full SHA
    7cead0e View commit details
    Browse the repository at this point in the history