infectious
infectious copied to clipboard
Extremely slow performance
Hi, I love this library but I'm experiencing some very slow speeds of 2 MB/s encode and 0.05 MB/s decode. Am I doing something wrong? Here's my usage of infectious which operates on byte slices.
// Reed-Solomon encoder
func rsEncode(rs *infectious.FEC,data []byte) []byte{
var res []byte
rs.Encode(data,func(s infectious.Share){
res = append(res,s.DeepCopy().Data[0])
})
return res
}
// Reed-Solomon decoder
func rsDecode(rs *infectious.FEC,data []byte) ([]byte,error){
tmp := make([]infectious.Share,rs.Total())
for i:=0;i<rs.Total();i++{
tmp[i] = infectious.Share{
Number:i,
Data:[]byte{data[i]},
}
}
res,err := rs.Decode(nil,tmp)
if err!=nil{
return data[:rs.Total()/3],err
}
return res,nil
}
Even a pure Python implementation I used is faster than this, so I must be doing something wrong. But I've read the docs multiple times and haven't been able to come up with a solution. Would you mind taking a quick look? Thank you very much!