s/hard/harm
On Wednesday, October 2, 2024 at 12:50:59 PM UTC+8 tapi...@gmail.com wrote:
> On Monday, September 30, 2024 at 1:51:17 PM UTC+8 Hikmatulloh Hari Mukti
> (Hari) wrote:
>
> > Maybe I should apologize for the origin of this idea:
> https://github.com/go101/go101/wiki/How-to-perfectly-c
On Monday, September 30, 2024 at 1:51:17 PM UTC+8 Hikmatulloh Hari Mukti
(Hari) wrote:
> Maybe I should apologize for the origin of this idea:
https://github.com/go101/go101/wiki/How-to-perfectly-clone-a-slice%3F
No worries, I learn a lot from articles you posted on go101.org, appreciate
it.
> Maybe I should apologize for the origin of this idea:
https://github.com/go101/go101/wiki/How-to-perfectly-clone-a-slice%3F
No worries, I learn a lot from articles you posted on go101.org, appreciate
it.
> My current opinion is that it is best to let the Go runtime specialize
zero-capacity s
Maybe I should apologize for the origin of this idea:
https://github.com/go101/go101/wiki/How-to-perfectly-clone-a-slice%3F
When I posted that wiki article, I was not aware of this (maybe tiny)
drawback.
My current opinion is that it is best to let the Go runtime specialize
zero-capacity slic
Thank Brian Candler for answering, this is the first time I use golang-nuts
so I accidentally sent you a private reply, I hope you don't mind.
Thanks Keith Randall for referring the issue and the CL, I didn't know if
there was one already. I'll join there.
On Friday 27 September 2024 at 05:33:3
There is an issue and CL for this ("this" = keeping the backing store alive
when cloning a zero-length slice). See:
https://github.com/golang/go/issues/68488
https://go-review.googlesource.com/c/go/+/598875
On Thursday, September 26, 2024 at 6:59:49 AM UTC-7 Brian Candler wrote:
> FWIW, I found
FWIW, I found this thread:
https://groups.google.com/g/golang-nuts/c/QFiyvup5UuY/m/xBalv9Y3CAAJ
which says experimentally (albeit without showing code or results) that
append(S(nil), s...)
append(s[:0:0], s...)
are faster than some other methods of cloning a slice, when s is "large".
On Th
> I want to know the reason behind the decision of using *append(s[:0:0],
s...)* over the previous code
It would be helpful to identify specifically the "previous code" you're
comparing against. Looking in git history I find this commit from about a
year ago:
commit b581e447394b4ba7a08ea64b21