You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by wo...@apache.org on 2020/01/06 04:29:45 UTC
[dubbo-go-hessian2] branch master updated: update gost v1.5.1 bytes
pool (#147)
This is an automated email from the ASF dual-hosted git repository.
wongoo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dubbo-go-hessian2.git
The following commit(s) were added to refs/heads/master by this push:
new 0e1fc43 update gost v1.5.1 bytes pool (#147)
0e1fc43 is described below
commit 0e1fc43955b27fbb46ee10a48f2322bb0c413496
Author: huiren <zh...@gmail.com>
AuthorDate: Mon Jan 6 12:29:36 2020 +0800
update gost v1.5.1 bytes pool (#147)
* update gost v1.5 bytes pool
* gost 1.5.1
* fix bufp
---
binary.go | 5 ++---
go.mod | 2 +-
go.sum | 4 ++--
string.go | 4 ++--
4 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/binary.go b/binary.go
index 6012aa5..1cdea45 100644
--- a/binary.go
+++ b/binary.go
@@ -134,11 +134,10 @@ func (d *Decoder) decBinary(flag int32) ([]byte, error) {
}
data := make([]byte, 0, 128)
- bufp := gxbytes.GetBytes(65546)
+ bufp := gxbytes.AcquireBytes(65536)
+ defer gxbytes.ReleaseBytes(bufp)
buf := *bufp
- defer gxbytes.PutBytes(bufp)
-
for {
length, err = d.getBinaryLength(tag)
if err != nil {
diff --git a/go.mod b/go.mod
index a5576d6..8497c83 100644
--- a/go.mod
+++ b/go.mod
@@ -1,7 +1,7 @@
module github.com/apache/dubbo-go-hessian2
require (
- github.com/dubbogo/gost v1.4.0
+ github.com/dubbogo/gost v1.5.1
github.com/pkg/errors v0.8.1
github.com/stretchr/testify v1.4.0
)
diff --git a/go.sum b/go.sum
index 2686d90..6c93958 100644
--- a/go.sum
+++ b/go.sum
@@ -1,7 +1,7 @@
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
-github.com/dubbogo/gost v1.4.0 h1:7YoSpTVvceK9OcZKeUB5stW1IfTPkZOVdJmsqWTu1D0=
-github.com/dubbogo/gost v1.4.0/go.mod h1:pPTjVyoJan3aPxBPNUX0ADkXjPibLo+/Ib0/fADXSG8=
+github.com/dubbogo/gost v1.5.1 h1:oG5dzaWf1KYynBaBoUIOkgT+YD0niHV6xxI0Odq7hDg=
+github.com/dubbogo/gost v1.5.1/go.mod h1:pPTjVyoJan3aPxBPNUX0ADkXjPibLo+/Ib0/fADXSG8=
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
diff --git a/string.go b/string.go
index 9737761..f692438 100644
--- a/string.go
+++ b/string.go
@@ -161,9 +161,9 @@ func encString(b []byte, v string) []byte {
byteCount = 0
)
- bufp := gxbytes.GetBytes(CHUNK_SIZE * 3)
+ bufp := gxbytes.AcquireBytes(CHUNK_SIZE * 3)
+ defer gxbytes.ReleaseBytes(bufp)
buf := *bufp
- defer gxbytes.PutBytes(bufp)
for {
if vBuf.Len() <= 0 {