buraksezer / consistent

Consistent hashing with bounded loads in Golang
https://research.googleblog.com/2017/04/consistent-hashing-with-bounded-loads.html
MIT License
693 stars 69 forks source link

about delSlice #4

Closed hepeng235767 closed 5 years ago

hepeng235767 commented 5 years ago

Hi, line 231, function delSlice, seems be better if make a new slice to store and assign to c.sortedSet or , change in-place like below:

func main(){
    m:=[]int{1,2,3,4,45,6,7,5,3,4,5,4,4,4,4,4}
    for i:=0;i<len(m)-1;{
        if m[i]==4{
            m=append(m[:i],m[i+1:]...)
            continue
        }
        i++
    }
    if m[len(m)-1]==4{
        m=m[:len(m)-1]
    }
    fmt.Println(m)
}
buraksezer commented 5 years ago

Hello,

Thank you very much for your interest in my project but I think the current status of function you mentioned is good enough.

Have a nice day.