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

Re-use 'keys' in ReadOffsetTable #645

Merged
merged 2 commits into from Jul 9, 2019

Conversation

codesome
Copy link
Contributor

@codesome codesome commented Jul 2, 2019

This is a broken down piece of #627

This saves a whole bunch of allocs when opening a block.

  • Add comment for why the len of keys is set to 2

Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>
@@ -781,9 +781,10 @@ func ReadOffsetTable(bs ByteSlice, off uint64, f func([]string, uint64) error) e
d := encoding.NewDecbufAt(bs, int(off), castagnoliTable)
cnt := d.Be32()

keys := make([]string, 0, 2)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

#627 (comment) tells why I have set the size to 2.

@bwplotka
Copy link
Contributor

bwplotka commented Jul 2, 2019

I love PR splitting - so much easier to review ❤️ @tomwilkie :trollface:

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.

Ship it!

shipit

Thanks for splitting this work into nice pieces 👍

Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>
@codesome codesome merged commit 8dfa537 into prometheus-junkyard:master Jul 9, 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

2 participants