-
Notifications
You must be signed in to change notification settings - Fork 130
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
Conversation
prune.go
Outdated
// remove and skip dir | ||
// spawn fo routine to do the removal | ||
wg.Add(1) | ||
go p.remove(path, info, &wg, errorChan) |
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.
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 ?
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.
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
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.
Maybe something like a threadpool?
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.
done, capped by cpu
tweaked a bit! seems to improve the perf almost 50% on my machine |
great! thats a lot cleaner too |
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 ?