-
Notifications
You must be signed in to change notification settings - Fork 540
feat: improve clone performance and reduce memory usage. #1170
Conversation
Signed-off-by: Nao YONASHIRO <[email protected]>
Signed-off-by: Nao YONASHIRO <[email protected]>
Signed-off-by: Nao YONASHIRO <[email protected]>
Signed-off-by: Nao YONASHIRO <[email protected]>
Signed-off-by: Nao YONASHIRO <[email protected]>
Signed-off-by: Nao YONASHIRO <[email protected]>
Signed-off-by: Nao YONASHIRO <[email protected]>
Signed-off-by: Nao YONASHIRO <[email protected]>
64f2fb7
to
76abe01
Compare
@@ -20,8 +20,14 @@ func (s *IndexStorage) SetIndex(idx *index.Index) (err error) { | |||
} | |||
|
|||
defer ioutil.CheckClose(f, &err) | |||
bw := bufio.NewWriter(f) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you found substantial difference using a buffered writer to save the index?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
local benchmark result. reverted bufio.Writer.
name old time/op new time/op delta
PlainClone-4 173s ± 5% 251s ± 9% +44.84% (p=0.008 n=5+5)
name old alloc/op new alloc/op delta
PlainClone-4 29.8GB ± 0% 29.4GB ± 0% -1.12% (p=0.008 n=5+5)
name old allocs/op new allocs/op delta
PlainClone-4 114M ± 0% 114M ± 0% -0.04% (p=0.008 n=5+5)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm doing more tests with our repository downloader and these changes makes it a little bit slower and consumes more memory. I'll continue digging why this could be.
It seems that the biggest improvement are the changes in I've been reviewing the changes for packfile and make sense but in some cases they make the code slower. I'm pretty sure this can be improved to get good gains in both memory and speed when it's generating the index. @mcuadros what do you think? |
Ok, I split PR. |
Shall I close this PR? |
@orisano I would love to take a look to the changes for packfile you did. Even if they are not increasing speed now they look very promising. Can you open a new PR with only the changes from the files in Thanks! |
ok |
The changes from this PR are now in #1180 |
I tried to clone
github.com/knqyf263/vuln-list
, butPlainClone
took a too long time.I improve clone performance and reduce memory usage!
benchstat results
thanks!