Skip to content
This repository has been archived by the owner on Aug 13, 2019. It is now read-only.

Reuse string buffer in stringTuples.Swap #654

Merged
merged 5 commits into from
Jul 10, 2019

Conversation

codesome
Copy link
Contributor

@codesome codesome commented Jul 5, 2019

This is a broken down piece of #627

[Don't merge until Prometheus 2.11 is out]

This reduces the allocs of WriteLabelIndex significantly.

Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>
@codesome
Copy link
Contributor Author

codesome commented Jul 5, 2019

Here are the benchmark results

benchmark                                                                                 old ns/op       new ns/op       delta
BenchmarkCompaction/type=normal,blocks=2,series=1000000,samplesPerSeriesPerBlock=51-8     12925384892     12786361556     -1.08%

benchmark                                                                                 old allocs     new allocs     delta
BenchmarkCompaction/type=normal,blocks=2,series=1000000,samplesPerSeriesPerBlock=51-8     15836497       10150083       -35.91%

benchmark                                                                                 old bytes      new bytes      delta
BenchmarkCompaction/type=normal,blocks=2,series=1000000,samplesPerSeriesPerBlock=51-8     2080160880     1988797488     -4.39%

index/index.go Outdated Show resolved Hide resolved
Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>
Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>
Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>
Copy link
Contributor

@bwplotka bwplotka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks. I guess the improvement is because we sort a lot (:

Copy link
Contributor

@csmarchbanks csmarchbanks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for making it lazy!

@codesome codesome merged commit b5b8c92 into prometheus-junkyard:master Jul 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants