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

subscriber: don't use SmallVecs for filter fields #1568

Merged
merged 2 commits into from
Sep 15, 2021

Commits on Sep 15, 2021

  1. add tests for printing the size of filters

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Sep 15, 2021
    Configuration menu
    Copy the full SHA
    3d27df4 View commit details
    Browse the repository at this point in the history
  2. subscriber: don't use SmallVecs for filter fields

    The `DirectiveSet` type used in `EnvFilter` and `Targets` uses
    `SmallVec` to store the filtering directives when the `SmallVec` feature
    is enabled. This is intended to improve the performance of iterating
    over small sets of directives, by avoiding a heap pointer dereference.
    
    PR #1550 changed the directives themselves to also use `SmallVec` for
    storing _field_ filters. This was intended to make the same optimization
    for field filters. However, it had unintended consequences: an empty
    `SmallVec` is an array of `T` items (plus metadata), while an empty
    `Vec` is just a couple of words. Since _most_ filters don't have field
    filters, this meant that we were suddenly using a lot more space to
    store...nothing. This made `EnvFilter`s _much_ larger, causing problems
    for some users (see #1567).
    
    This branch undoes the change to `SmallVec` for field name/value
    filters. This takes the size of an `EnvFilter` from 5420 bytes back down
    to 1272 bytes.
    
    Fixes #1567
    hawkw committed Sep 15, 2021
    Configuration menu
    Copy the full SHA
    d62b741 View commit details
    Browse the repository at this point in the history