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

perf: avoid allocations when filtering nodes #11

Merged
merged 2 commits into from
Aug 30, 2018
Merged

Conversation

dignifiedquire
Copy link
Member

After @whyrusleeping demonstrated us how to find slow code, I went and made this a bit faster.

Test used to profile is in go-mfs

screen shot 2018-08-28 at 21 43 50

pprof before
screen shot 2018-08-28 at 21 39 08

pprof after
screen shot 2018-08-28 at 21 37 57

@ghost ghost assigned dignifiedquire Aug 28, 2018
@ghost ghost added the status/in-progress In progress label Aug 28, 2018
@whyrusleeping
Copy link
Member

nice improvement.

Probably want to use the 'idiomatic' slice filter though: https://github.com/golang/go/wiki/SliceTricks#filtering-without-allocating

@dignifiedquire
Copy link
Member Author

dignifiedquire commented Aug 28, 2018 via email

@Stebalien
Copy link
Member

In-place is definitely what we want. The slice trick may not be quite as fast but it's much easier to read and should be fast enough for us.

@dignifiedquire
Copy link
Member Author

changed, speed improvements in that test are similar, so looks like go does optimize this nicely

@Stebalien Stebalien merged commit 319d880 into master Aug 30, 2018
@ghost ghost removed the status/in-progress In progress label Aug 30, 2018
@Stebalien Stebalien deleted the fast-remove branch August 30, 2018 23:01
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