-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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
slices: make Clone preallocate and copy instead of solely invoking append #61186
Conversation
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
This PR (HEAD: bca616b) has been imported to Gerrit for code review. Please visit https://go-review.googlesource.com/c/go/+/508075 to see it. Tip: You can toggle comments from me using the |
Message from Gopher Robot: Patch Set 1: Congratulations on opening your first change. Thank you for your contribution! Next steps: Most changes in the Go project go through a few rounds of revision. This can be During May-July and Nov-Jan the Go project is in a code freeze, during which Please don’t reply on this GitHub thread. Visit golang.org/cl/508075. |
Message from Emmanuel Odeke: Patch Set 1: Hold+1 (2 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/508075. |
Message from Keith Randall: Patch Set 1: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/508075. |
This PR (HEAD: 2c26c97) has been imported to Gerrit for code review. Please visit https://go-review.googlesource.com/c/go/+/508075 to see it. Tip: You can toggle comments from me using the |
Change the implementation of slices Clone. It's 28% faster on my laptop. As discussed in #57433 (comment), no extra issue is needed for this simple fix. goos: darwin goarch: arm64 pkg: github.com/David-Mao/Euclid/Go/utils │ old.txt │ new.txt │ │ sec/op │ sec/op vs base │ Clone-12 16.95n ± 1% 12.06n ± 2% -28.85% (p=0.000 n=10)
This PR (HEAD: 0669c38) has been imported to Gerrit for code review. Please visit https://go-review.googlesource.com/c/go/+/508075 to see it. Tip: You can toggle comments from me using the |
Message from David Mao: Patch Set 4: (3 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/508075. |
Message from Keith Randall: Patch Set 5: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/508075. |
Message from David Mao: Patch Set 5: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/508075. |
Message from Ian Lance Taylor: Patch Set 5: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/508075. |
Message from David Mao: Patch Set 5: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/508075. |
This PR is being closed because golang.org/cl/508075 has been abandoned. Not doing this. |
slices: make Clone preallocate and copy instead of solely invoking append
By preallocating a slice of equal size then invoking copy, this
change results in a speedup: