pooling []byte

reduce the number of requests to make([]byte)
This commit is contained in:
chrislusf
2016-04-14 01:30:26 -07:00
parent 95e0d2f1b2
commit 0649d778a7
9 changed files with 216 additions and 7 deletions

View File

@@ -50,7 +50,8 @@ func (vs *VolumeServer) getVolumeDataContentHandler(w http.ResponseWriter, r *ht
}
offset := uint32(util.ParseUint64(r.FormValue("offset"), 0))
size := uint32(util.ParseUint64(r.FormValue("size"), 0))
content, err := storage.ReadNeedleBlob(v.DataFile(), int64(offset)*storage.NeedlePaddingSize, size)
content, rawBytes, err := storage.ReadNeedleBlob(v.DataFile(), int64(offset)*storage.NeedlePaddingSize, size)
defer storage.ReleaseBytes(rawBytes)
if err != nil {
writeJsonError(w, r, http.StatusInternalServerError, err)
return