Skip to content

Small optimisations to Ingester.append() #1654

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

Merged
merged 2 commits into from
Sep 7, 2019
Merged

Small optimisations to Ingester.append() #1654

merged 2 commits into from
Sep 7, 2019

Conversation

bboreham
Copy link
Contributor

@bboreham bboreham commented Sep 6, 2019

  • Protect two data structures with one lock - since stopped is only used in one place, that is already taking a lock, re-use userStatesMtx and skip the effort to check the stopLock and defer Unlock it.
  • Combine two defers into one - each defer involves some memory allocation and housekeeping so we can save half the effort.

Since `stopped` is only used in one place, that is already taking a
lock, re-use that lock and skip the effort to check the other lock and
defer unlock it.

Signed-off-by: Bryan Boreham <[email protected]>
Each defer involves some memory allocation and housekeeping - since
they are right next to one another we can save half the effort.

Signed-off-by: Bryan Boreham <[email protected]>
@bboreham bboreham merged commit 9539ae1 into master Sep 7, 2019
@bboreham bboreham deleted the optimise-append branch September 7, 2019 17:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants