Skip to content
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

Prune using goroutines[capped by CPU] #5

Closed

Conversation

bhaskarsaraogi
Copy link

Hey, was just trying out the idea from #3
Have tried a couple of use cases, works fine. No great perf improvements though.
Looking for your comments, trying to see if it makes any sense ?

prune.go Outdated
// remove and skip dir
// spawn fo routine to do the removal
wg.Add(1)
go p.remove(path, info, &wg, errorChan)
Copy link
Author

Choose a reason for hiding this comment

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

could even move this part above and do the stats(atomic inc the stats value then though) counting in goroutine itself ?
but before that trying to see if any of this makes sense/adds value ?

Copy link
Owner

@tj tj Nov 19, 2017

Choose a reason for hiding this comment

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

hmm I think a goroutine per file is a big excessive maybe. I wonder if just launching one per cpu, will maybe improve the performance, as there's maybe contention

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe something like a threadpool?

Copy link
Author

Choose a reason for hiding this comment

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

done, capped by cpu

@bhaskarsaraogi bhaskarsaraogi changed the title Prune using goroutines Prune using goroutines[capped by CPU] Nov 19, 2017
@tj tj closed this in fbb44fa Nov 19, 2017
@tj
Copy link
Owner

tj commented Nov 19, 2017

tweaked a bit! seems to improve the perf almost 50% on my machine

@bhaskarsaraogi
Copy link
Author

great! thats a lot cleaner too

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.

3 participants