You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2021/07/02 05:57:04 UTC

[GitHub] [dubbo-go-hessian2] wongoo commented on a change in pull request #271: reuse allocated buffer

wongoo commented on a change in pull request #271:
URL: https://github.com/apache/dubbo-go-hessian2/pull/271#discussion_r662755562



##########
File path: encode.go
##########
@@ -56,6 +54,22 @@ func (e *Encoder) Clean() {
 	e.refMap = make(map[unsafe.Pointer]_refElem, 7)
 }
 
+// ReuseBufferClean reuse the Encoder for a new object encoding.
+// it reuse allocated buffer and reduce memory-allocation.
+func (e *Encoder) ReuseBufferClean() {
+	var buffer []byte
+	if len(e.buffer) <= 128 {

Review comment:
       does it need to check the buffer length?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org