Skip to content
This repository has been archived by the owner on Sep 11, 2020. It is now read-only.

plumbing: format/idxfile, avoid creating temporary buffers to decode integers #1136

Merged
merged 3 commits into from
Apr 26, 2019

Conversation

filipnavara
Copy link
Contributor

@filipnavara filipnavara commented Apr 25, 2019

On Linux repository (210 MB pack index; 6,596,227 objects) this saves around 2 seconds in genOffsetHash function.

@filipnavara
Copy link
Contributor Author

The profile shows there's still some room for optimization here:

image

…y not using iterator and not loading CRC

Signed-off-by: Filip Navara <[email protected]>
@filipnavara filipnavara reopened this Apr 25, 2019
@mcuadros mcuadros requested a review from jfontan April 26, 2019 08:00
copy(hash[:], idx.Names[mappedFirstLevel][secondLevel*objectIDLength:])
offset := int64(idx.getOffset(mappedFirstLevel, int(secondLevel)))
idx.offsetHash[offset] = hash
secondLevel++
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this a leftover?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nope. The loop is a bit weird since it's iterating over two variables. Maybe there's some better Go syntax for it?

secondLevel goes from 0 to maximum value on that fanout level (not checked directly). i goes from 0 over both the inner and outer loop and bounds the inner loop.

@mcuadros mcuadros merged commit f22c6b9 into src-d:master Apr 26, 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.

3 participants